JSON.parse() returns an object appropriate for the input. So, if you called:
JSON.parse("['a', 'b', 'c']");
you'd get a String sequence. However, if you called:
JSON.parse("[0, 1, 2]");
you'd get an Integer sequence. If you called:
JSON.parse("{a: 100, b: 200}");
you'd get a Map<String, Object> containing keys "a" and "b". If you called:
JSON.parse("'Hello'");
you'd get a String, and if you called:
JSON.parse("100");
you'd get an Integer.
Basically, you get back the Java equivalent of the JSON value you pass in.
On Sep 19, 2011, at 8:22 AM, Brendan cheng wrote:
>
> Hi,
> I was trying to use your api for JSON parse.How to construct a JSON using
> your API?you provide a JSON.parse which generate a sequence of String only.
> Brendan