mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-04-28 02:33:28 +02:00
update docs
This commit is contained in:
parent
964affd333
commit
948f29032e
@ -16,7 +16,7 @@ JsonCpp - JSON data format manipulation library
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td width="40%" align="right" valign="center">
|
<td width="40%" align="right" valign="center">
|
||||||
<a href="https://github.com/open-source-parsers/jsoncpp">JsonCpp home page</a>
|
<a href="http://open-source-parsers.github.io/jsoncpp-docs/doxygen/">JsonCpp home page</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -4,11 +4,21 @@
|
|||||||
|
|
||||||
<a HREF="http://www.json.org/">JSON (JavaScript Object Notation)</a>
|
<a HREF="http://www.json.org/">JSON (JavaScript Object Notation)</a>
|
||||||
is a lightweight data-interchange format.
|
is a lightweight data-interchange format.
|
||||||
It can represent integer, real number, string, an ordered sequence of value, and
|
|
||||||
a collection of name/value pairs.
|
|
||||||
|
|
||||||
Here is an example of JSON data:
|
Here is an example of JSON data:
|
||||||
\verbatim
|
\verbatim
|
||||||
|
{
|
||||||
|
"encoding" : "UTF-8",
|
||||||
|
"plug-ins" : [
|
||||||
|
"python",
|
||||||
|
"c++",
|
||||||
|
"ruby"
|
||||||
|
],
|
||||||
|
"indent" : { "length" : 3, "use_space": true }
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
<b>JsonCpp</b> supports comments as <i>meta-data</i>:
|
||||||
|
\code
|
||||||
// Configuration options
|
// Configuration options
|
||||||
{
|
{
|
||||||
// Default encoding for text
|
// Default encoding for text
|
||||||
@ -17,22 +27,22 @@ Here is an example of JSON data:
|
|||||||
// Plug-ins loaded at start-up
|
// Plug-ins loaded at start-up
|
||||||
"plug-ins" : [
|
"plug-ins" : [
|
||||||
"python",
|
"python",
|
||||||
"c++",
|
"c++", // trailing comment
|
||||||
"ruby"
|
"ruby"
|
||||||
],
|
],
|
||||||
|
|
||||||
// Tab indent size
|
// Tab indent size
|
||||||
"indent" : { "length" : 3, "use_space": true }
|
// (multi-line comment)
|
||||||
|
"indent" : { /*embedded comment*/ "length" : 3, "use_space": true }
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endcode
|
||||||
<code>jsoncpp</code> supports comments as <i>meta-data</i>.
|
|
||||||
|
|
||||||
\section _features Features
|
\section _features Features
|
||||||
- read and write JSON document
|
- read and write JSON document
|
||||||
- attach C++ style comments to element during parsing
|
- attach C++ style comments to element during parsing
|
||||||
- rewrite JSON document preserving original comments
|
- rewrite JSON document preserving original comments
|
||||||
|
|
||||||
Notes: Comments used to be supported in JSON but where removed for
|
Notes: Comments used to be supported in JSON but were removed for
|
||||||
portability (C like comments are not supported in Python). Since
|
portability (C like comments are not supported in Python). Since
|
||||||
comments are useful in configuration/input file, this feature was
|
comments are useful in configuration/input file, this feature was
|
||||||
preserved.
|
preserved.
|
||||||
@ -40,7 +50,7 @@ preserved.
|
|||||||
\section _example Code example
|
\section _example Code example
|
||||||
|
|
||||||
\code
|
\code
|
||||||
Json::Value root; // will contains the root value after parsing.
|
Json::Value root; // will contain the root value after parsing.
|
||||||
Json::Reader reader;
|
Json::Reader reader;
|
||||||
bool parsingSuccessful = reader.parse( config_doc, root );
|
bool parsingSuccessful = reader.parse( config_doc, root );
|
||||||
if ( !parsingSuccessful )
|
if ( !parsingSuccessful )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user