I am having problem that string and number are recognized as valid application/json and Restlet returns a ERROR 500 before my code is called. For instance a payload of "8" (with or with quotes) on a PUT to
@Put( "json" ) <T> void store( InputRepresentation value );
I am using the jackson extension (2.10.1) and version 2.4.1 of restlet.
Is this due to following RFC4627 where
JSON-text = object / array
which is incorrect and superceded by RFC7159 followed by RFC8259 which defines it as
JSON-text = ws value ws
Jackson itself handles it (perhaps even more than it should);
Object a = new ObjectMapper().readValue( "12", Integer.class); Object b = new ObjectMapper().readValue( "\"12\"", Integer.class); Object c = new ObjectMapper().readValue( "\"12\"", String.class); Object d = new ObjectMapper().readValue( "12", String.class); System.out.println(a.getClass() + " " + a); System.out.println(b.getClass() + " " + b); System.out.println(c.getClass() + " " + c); System.out.println(d.getClass() + " " + d);
class java.lang.Integer 12 class java.lang.Integer 12 class java.lang.String 12 class java.lang.String 12
(other operations such as getting tokens, readTree and so on also works)
OR is it something I completely missed to make it work?
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].