pascallouisperez / jsonmarshaller

JsonMarshaller is a Java 1.5 library that allows marshalling and unmarshalling of JSON objects to and from entities ("Java classes").
Apache License 2.0
1 stars 0 forks source link

Ambiguous strings break Json#fromString #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following Json#fromString call

  assertEquals(Json.string("foo"), Json.fromString("foo"));

throws the exception

  java.lang.IllegalArgumentException: false expected

The string "false" is indeed ambiguous, it could either be Json.FALSE or 
Json.string("false"). However, all other strings starting with an "f" aren't 
ambiguous.

I am not sure what the expected output should be. I ran into this issue when 
using a Marshaller<String> 

  createMarshaller(String.class).unmarshall(Json.fromString("foo"));

Original issue reported on code.google.com by julien.w...@gmail.com on 13 Sep 2010 at 9:01

GoogleCodeExporter commented 9 years ago
This is actually a non-issue

Json.string(...)

takes a Java string and produces a Json.String but

Json.fromString

parses a JSON string, and thus strings must be quoted

Original comment by pascallo...@gmail.com on 14 Sep 2010 at 1:40