Last updated at 9:52 am UTC on 29 June 2017
JSON is built on two structures:
- A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
- An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.
For version http://www.squeaksource.com/JSON/JSON-tonyg.39.mcz
all tests green in Squeak 5.1. The main object is JsonObject.
see also STON
Author: Hannes Hirzel
In the project SCouchDB a copy of JSON is maintained by Igor Stasenko
and Radoslav Hodnicak.
This merges part of the changes back, in particular
1. JsonObject is now a subclass of Dictionary instead of Object. So
there is no need to implement the Dictionary interface.
2. Fix for converting Unicode characters to \uNNNN format (missing
padding to 4 characters)
No further changes
The SCouchDB project contains more changes in the copy of the JSON package.
I did not go further in merging because in SCouchDB / JSON-rh.32
Radoslav Hodnicak introduces an instance variable 'converter'
which is initialized to
converter := UTF8TextConverter new
Igor Stasenko, Levente Uzonyi and Hannes Hirzel agreed that the UTF8
conversion does not belong into the JSON package
You only need to convert the characters to UTF-8, because you're
sending them over the network to a server, and Unicode characters have
to be converted to bytes someway. So the JSON printer shouldn't do any
conversion by default except for escaping. The only problem is that
escaping is not done as the spec requires it, but that's easy to fix.
A string is a collection of zero or more Unicode characters, wrapped
in double quotes, using backslash escapes. A character is represented
as a single character string. A string is very much like a C or Java
About escaping Unicode characters
Actually escaping Unicode characters to
is not necessary for characters with codes >127 in case of an upload
to a CouchDB. But this version does it.
In case you want to patch this change method
Json class escapeForCharacter: c
Test case see WebClient, JSON and couchDB