1- Introduction
2- ------------
1+ # JsonCpp
32
43[ JSON] [ json-org ] is a lightweight data-interchange format. It can represent
54numbers, strings, ordered sequences of values, and collections of name/value
65pairs.
76
87[ json-org ] : http://json.org/
98
10- [ JsonCpp] [ ] is a C++ library that allows manipulating JSON values, including
9+ JsonCpp is a C++ library that allows manipulating JSON values, including
1110serialization and deserialization to and from strings. It can also preserve
1211existing comment in unserialization/serialization steps, making it a convenient
1312format to store user input files.
1413
15- [ JsonCpp ] : http://open-source-parsers.github.io/jsoncpp-docs/doxygen/index.html
14+
15+ ## Documentation
16+
17+ [ JsonCpp documentation] [ JsonCpp-documentation ] is generated using [ Doxygen] [ ] .
18+
19+ [ JsonCpp-documentation ] : http://open-source-parsers.github.io/jsoncpp-docs/doxygen/index.html
20+ [ Doxygen ] : http://www.doxygen.org
21+
1622
1723## A note on backward-compatibility
24+
1825* ` 1.y.z ` is built with C++11.
1926* ` 0.y.z ` can be used with older compilers.
2027* Major versions maintain binary-compatibility.
2128
22- # Using JsonCpp in your project
23- -----------------------------
29+
30+ ## Using JsonCpp in your project
31+
2432The recommended approach to integrating JsonCpp in your project is to include
2533the [ amalgamated source] ( #generating-amalgamated-source-and-header ) (a single
2634` .cpp ` file and two ` .h ` files) in your project, and compile and build as you
2735would any other source file. This ensures consistency of compilation flags and
2836ABI compatibility, issues which arise when building shared or static
2937libraries. See the next section for instructions.
3038
31- The ` include/ ` should be added to your compiler include path. Jsoncpp headers
39+ The ` include/ ` should be added to your compiler include path. JsonCpp headers
3240should be included as follow:
3341
3442 #include <json/json.h>
3543
36- If JsonCpp was built as a dynamic library on Windows, then your project needs to
37- define the macro ` JSON_DLL ` .
44+ If JsonCpp was built as a dynamic library on Windows, then your project needs to define the macro ` JSON_DLL ` .
45+
46+ ### Generating amalgamated source and header
3847
39- Generating amalgamated source and header
40- ----------------------------------------
4148JsonCpp is provided with a script to generate a single header and a single
4249source file to ease inclusion into an existing project. The amalgamated source
4350can be generated at any time by running the following command from the
@@ -48,6 +55,7 @@ top-directory (this requires Python 2.6):
4855It is possible to specify header name. See the ` -h ` option for detail.
4956
5057By default, the following files are generated:
58+
5159* ` dist/jsoncpp.cpp ` : source file that needs to be added to your project.
5260* ` dist/json/json.h ` : corresponding header file for use in your project. It is
5361 equivalent to including ` json/json.h ` in non-amalgamated source. This header
@@ -56,15 +64,14 @@ By default, the following files are generated:
5664 JsonCpp types.
5765
5866The amalgamated sources are generated by concatenating JsonCpp source in the
59- correct order and defining the macro ` JSON_IS_AMALGAMATION ` to prevent inclusion
60- of other headers.
67+ correct order and defining the macro ` JSON_IS_AMALGAMATION ` to prevent inclusion of other headers.
6168
62- # Contributing to JsonCpp
6369
64- Building and testing with CMake
65- -------------------------------
66- [ CMake] [ ] is a C++ Makefiles/Solution generator. It is usually available on most
67- Linux system as package. On Ubuntu:
70+ ## Contributing to JsonCpp
71+
72+ ### Building and testing with CMake
73+
74+ [ CMake] [ ] is a C++ Makefiles/Solution generator. It is usually available on most Linux system as package. On Ubuntu:
6875
6976 sudo apt-get install cmake
7077
@@ -75,9 +82,9 @@ missing, the build will skip running those tests.
7582
7683When running CMake, a few parameters are required:
7784
78- * a build directory where the makefiles/solution are generated. It is also used
85+ * A build directory where the makefiles/solution are generated. It is also used
7986 to store objects, libraries and executables files.
80- * the generator to use: makefiles or Visual Studio solution? What version or
87+ * The generator to use: makefiles or Visual Studio solution? What version or
8188 Visual Studio, 32 or 64 bits solution?
8289
8390Steps for generating solution/makefiles using ` cmake-gui ` :
@@ -107,10 +114,10 @@ the `-G` option).
107114By default CMake hides compilation commands. This can be modified by specifying
108115` -DCMAKE_VERBOSE_MAKEFILE=true ` when generating makefiles.
109116
110- Building and testing with SCons
111- -------------------------------
112- ** Note:** The SCons-based build system is deprecated. Please use CMake; see the
113- section above.
117+ ### Building and testing with SCons
118+
119+ ** Note:** The SCons-based build system is deprecated. Please use CMake ( see the
120+ section above) .
114121
115122JsonCpp can use [ Scons] [ ] as a build system. Note that SCons requires Python to
116123be installed.
@@ -137,7 +144,8 @@ If you are building with Microsoft Visual Studio 2008, you need to set up the
137144environment by running ` vcvars32.bat ` (e.g. MSVC 2008 command prompt) before
138145running SCons.
139146
140- ## Running the tests manually
147+ ### Running the tests manually
148+
141149You need to run tests manually only if you are troubleshooting an issue.
142150
143151In the instructions below, replace ` path/to/jsontest ` with the path of the
@@ -160,21 +168,22 @@ In the instructions below, replace `path/to/jsontest` with the path of the
160168 # You can run the tests using valgrind:
161169 python rununittests.py --valgrind path/to/test_lib_json
162170
163- ## Running the tests using scons
171+ ### Running the tests using SCons
172+
164173Note that tests can be run using SCons using the ` check ` target:
165174
166175 scons platform=$PLATFORM check
167176
168- Building the documentation
169- --------------------------
177+ ### Building the documentation
178+
170179Run the Python script ` doxybuild.py ` from the top directory:
171180
172181 python doxybuild.py --doxygen=$(which doxygen) --open --with-dot
173182
174183See ` doxybuild.py --help ` for options.
175184
176- Adding a reader/writer test
177- ---------------------------
185+ ### Adding a reader/writer test
186+
178187To add a test, you need to create two files in test/data:
179188
180189* a ` TESTNAME.json ` file, that contains the input document in JSON format.
@@ -183,21 +192,19 @@ To add a test, you need to create two files in test/data:
183192
184193The ` TESTNAME.expected ` file format is as follows:
185194
186- * each line represents a JSON element of the element tree represented by the
195+ * Each line represents a JSON element of the element tree represented by the
187196 input document.
188- * each line has two parts: the path to access the element separated from the
197+ * Each line has two parts: the path to access the element separated from the
189198 element value by ` = ` . Array and object values are always empty (i.e.
190199 represented by either ` [] ` or ` {} ` ).
191- * element path: ` . ` represents the root element, and is used to separate object
200+ * Element path ` . ` represents the root element, and is used to separate object
192201 members. ` [N] ` is used to specify the value of an array element at index ` N ` .
193202
194- See the examples ` test_complex_01.json ` and ` test_complex_01.expected ` to better
195- understand element paths.
203+ See the examples ` test_complex_01.json ` and ` test_complex_01.expected ` to better understand element paths.
196204
197- Understanding reader/writer test output
198- ---------------------------------------
199- When a test is run, output files are generated beside the input test files.
200- Below is a short description of the content of each file:
205+ ### Understanding reader/writer test output
206+
207+ When a test is run, output files are generated beside the input test files. Below is a short description of the content of each file:
201208
202209* ` test_complex_01.json ` : input JSON document.
203210* ` test_complex_01.expected ` : flattened JSON element tree used to check if
@@ -212,7 +219,7 @@ Below is a short description of the content of each file:
212219* ` test_complex_01.process-output ` : ` jsontest ` output, typically useful for
213220 understanding parsing errors.
214221
215- License
216- -------
222+ ## License
223+
217224See the ` LICENSE ` file for details. In summary, JsonCpp is licensed under the
218225MIT license, or public domain if desired and recognized in your jurisdiction.
0 commit comments