[Seaside] json parser patch

Boris Popov, DeepCove Labs boris at deepcovelabs.com
Mon Sep 12 17:54:10 UTC 2011


In JSON keys in an object can only be strings, but your example has no
quotes around them, thus, it's not valid JSON. Instead, try,

 

JSJsonParser parse: '{"lhs": "1 Brazil real","rhs": "0.592768 U.S.
dollars","error": "","icc": true}'

 

Dictionary ('error' -> '' 'lhs' -> '1 Brazil real' 'rhs' -> '0.592768
U.S. dollars' 'icc' -> true)

 

HTH,

 

-Boris

 

From: seaside-bounces at lists.squeakfoundation.org
[mailto:seaside-bounces at lists.squeakfoundation.org] On Behalf Of
Sebastian Sastre
Sent: Monday, September 12, 2011 1:47 PM
To: Seaside - general discussion
Subject: Re: [Seaside] json parser patch

 

Lukas, Phillipe,

 

sure? 

 

I see it says:

"...A value can be a string in double quotes, or a number, or true or
false or null, or an object or an array..."

 

which translates to:

1. A value, like when value means something different than a key

2. can, like when can means something more flexible than a has to

 

I am missing something?

 

sebastian <http://about.me/sebastianconcept> 

 

o/

 

 

 

On Sep 12, 2011, at 2:28 PM, Philippe Marschall wrote:





2011/9/12 Sebastian Sastre <sebastian at flowingconcept.com>:



Maybe this is useful to someone:

	Try this:

	JSJsonParser parseStream: '{lhs: "1 Brazil real",rhs: "0.592768
U.S.

	dollars",error: "",icc: true}' readStream

	it can't parse that, so..


Because it's not JSON. JSON keys need to be quoted [1]

[1] http://json.org/

Cheers
Philippe
_______________________________________________
seaside mailing list
seaside at lists.squeakfoundation.org
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20110912/ce7e2e6b/attachment.htm


More information about the seaside mailing list