On 24 Apr 2012, at 21:05, Dale Henrichs wrote:
Sven,
Just an off-the-wall thought... If JSON were a subset of STON ... or possibly STON would recognize JSON and parse despite the different syntax...we'd have a nice multipurpose parser/writer that could speak JSON or STON interchangeably...
Dale
That is a great idea, Dale, I never thought of that ! Apart from the fact that I used single quotes for strings in STON, it already works (and I could enhance the parser to accept both I guess). Here is an example using a JSON REST call to convert IP addresses to countries: *nix Shell: $ curl http://easy.t3-platform.net/rest/geo-ip?address=205.140.197.101 {"latitude":38.0,"address":"205.140.197.101","country":"US","longitude":-97.0} Smalltalk: ZnClient new systemPolicy; beOneShot; url: 'http://easy.t3-platform.net/rest/geo-ip'; queryAt: 'address' put: '205.140.197.101'; accept: ZnMimeType applicationJson; contentReader: [ :entity | STON fromString: (entity contents replaceAll: $" with: $') ]; get. a Dictionary('address'->'205.140.197.101' 'country'->'US' 'latitude'->38.0 'longitude'->-97.0 ) Thx, Sven