]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/property_tree/doc/json_parser.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / property_tree / doc / json_parser.qbk
CommitLineData
7c673cae
FG
1[/
2 / Copyright (c) 2008 Marcin Kalicinski (kalita <at> poczta dot onet dot pl)
3 / Copyright (c) 2009 Sebastian Redl (sebastian dot redl <at> getdesigned dot at)
4 /
5 / Distributed under the Boost Software License, Version 1.0. (See accompanying
6 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 /]
8[section JSON Parser]
9[def __json__ [@http://en.wikipedia.org/wiki/JSON JSON format]]
10The __json__ is a data interchange format derived from the object literal
11notation of JavaScript. (JSON stands for JavaScript Object Notation.)
12JSON is a simple, compact format for loosely structured node trees of any depth,
13very similar to the property tree dataset. It is less structured than XML and
14has no schema support, but has the advantage of being simpler, smaller and typed
15without the need for a complex schema.
16
17The property tree dataset is not typed, and does not support arrays as such.
18Thus, the following JSON / property tree mapping is used:
19
20* JSON objects are mapped to nodes. Each property is a child node.
21* JSON arrays are mapped to nodes. Each element is a child node with an empty
22 name. If a node has both named and unnamed child nodes, it cannot be mapped
23 to a JSON representation.
24* JSON values are mapped to nodes containing the value. However, all type
25 information is lost; numbers, as well as the literals "null", "true" and
26 "false" are simply mapped to their string form.
27* Property tree nodes containing both child nodes and data cannot be mapped.
28
29JSON round-trips, except for the type information loss.
30
31For example this JSON:
32
33 {
34 "menu":
35 {
36 "foo": true,
37 "bar": "true",
38 "value": 102.3E+06,
39 "popup":
40 [
41 {"value": "New", "onclick": "CreateNewDoc()"},
42 {"value": "Open", "onclick": "OpenDoc()"},
43 ]
44 }
45 }
46
47will be translated into the following property tree:
48
49 menu
50 {
51 foo true
52 bar true
53 value 102.3E+06
54 popup
55 {
56 ""
57 {
58 value New
59 onclick CreateNewDoc()
60 }
61 ""
62 {
63 value Open
64 onclick OpenDoc()
65 }
66 }
67 }
68
69[endsect] [/json_parser]