44
55<a HREF="http://www.json.org/">JSON (JavaScript Object Notation)</a>
66 is a lightweight data-interchange format.
7- It can represent integer, real number, string, an ordered sequence of value, and
8- a collection of name/value pairs.
97
108Here is an example of JSON data:
119\verbatim
10+ {
11+ "encoding" : "UTF-8",
12+ "plug-ins" : [
13+ "python",
14+ "c++",
15+ "ruby"
16+ ],
17+ "indent" : { "length" : 3, "use_space": true }
18+ }
19+ \endverbatim
20+ <b>JsonCpp</b> supports comments as <i>meta-data</i>:
21+ \code
1222// Configuration options
1323{
1424 // Default encoding for text
@@ -17,30 +27,30 @@ Here is an example of JSON data:
1727 // Plug-ins loaded at start-up
1828 "plug-ins" : [
1929 "python",
20- "c++",
30+ "c++", // trailing comment
2131 "ruby"
2232 ],
2333
2434 // Tab indent size
25- "indent" : { "length" : 3, "use_space": true }
35+ // (multi-line comment)
36+ "indent" : { /*embedded comment*/ "length" : 3, "use_space": true }
2637}
27- \endverbatim
28- <code>jsoncpp</code> supports comments as <i>meta-data</i>.
38+ \endcode
2939
3040\section _features Features
3141- read and write JSON document
3242- attach C++ style comments to element during parsing
3343- rewrite JSON document preserving original comments
3444
35- Notes: Comments used to be supported in JSON but where removed for
45+ Notes: Comments used to be supported in JSON but were removed for
3646portability (C like comments are not supported in Python). Since
3747comments are useful in configuration/input file, this feature was
3848preserved.
3949
4050\section _example Code example
4151
4252\code
43- Json::Value root; // will contains the root value after parsing.
53+ Json::Value root; // will contain the root value after parsing.
4454Json::Reader reader;
4555bool parsingSuccessful = reader.parse( config_doc, root );
4656if ( !parsingSuccessful )
0 commit comments