[Seaside] json parser patch
Sebastian Sastre
sebastian at flowingconcept.com
Mon Sep 12 17:04:43 UTC 2011
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..
...patch it with this:
JSJsonParser#parseProperty
| name value |
name := self parsePropertyName.
value := self parseValue.
^ self createProperty: name with: value.
JSJsonParser#parsePropertyName
| result |
result := WriteStream on: String new.
[ stream atEnd or: [ stream peek = $: ] ]
whileFalse: [ result nextPut: self parseCharacter ].
^ self expect: ':'; createString: result contents
then you get it working like this:
a Dictionary('error'->'' 'icc'->true 'lhs'->'1 Brazil real' 'rhs'->'0.592768 U.S. dollars' )
sebastian
o/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20110912/fb809a3b/attachment.htm
More information about the seaside
mailing list