Sorry, I meant JSONSerializer, not JSON. JSON#parse() is used to parse a JSON
path (such as "foo.bar[100]") into a sequence of string keys.
JSONSerializer#parse() will read JSON data into a Java object representation.
On Sep 19, 2011, at 11:03 AM, Brendan cheng wrote:
>
> Hi Greg,
> When I run this:
> JSON.parse("{a: 100, b: 200}");
> I got illegal identifier character.
> ----------------------------------------
>> Subject: Re: JSON usage
>> From: [email protected]
>> Date: Mon, 19 Sep 2011 08:36:22 -0400
>> To: [email protected]
>>
>> 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
>>
>