Here is a primitive json decoder (even two), carefully bydlokod but well kommentirovannyi, wrote not to carry a heavy 'right' projects json (plus not require new versions .net Will work almost since 1.1, including mono), requires zapilivanija error-handling syntax, etc. (read todo: in comentary).
The first method SimpleJSON::pairsParseJSON(string)
— returns a single-level Dictionaryeach record — the elements-the leaves in the tree in the json, the key compound name elements separated by a dot (the arrays are named using '[index]'), for example:
will give an array:
"test.a" => "1"p.s. this method is very convenient when working with complex json structures without arrays
"test.b" => "asd"
"test" => "123"
The second method SimpleJSON::treeParseJSON(string) — returns the classic multi-level dictionarywhere as object can be either a string or a number, or another dictionary.