7
7
8
8
[ json-org ] : http://json.org/
9
9
10
- JsonCpp is a C++ library that allows manipulating JSON values, including
10
+ [ JsonCpp] [ ] is a C++ library that allows manipulating JSON values, including
11
11
serialization and deserialization to and from strings. It can also preserve
12
12
existing comment in unserialization/serialization steps, making it a convenient
13
13
format to store user input files.
14
14
15
+ [ JsonCpp ] : http://open-source-parsers.github.io/jsoncpp-docs/doxygen/index.html
16
+
15
17
## A note on backward-compatibility
16
- Very soon, we are switching to C++11 only. For older compilers, try the ` pre-C++11 ` branch.
18
+ * ` 1.y.z ` is built with C++11.
19
+ * ` 0.8.z ` can be used with older compilers.
20
+ * Major versions maintain binary-compatibility.
17
21
18
22
Using JsonCpp in your project
19
23
-----------------------------
20
-
21
24
The recommended approach to integrating JsonCpp in your project is to build
22
25
the amalgamated source (a single ` .cpp ` file) with your own build system. This
23
26
ensures consistency of compilation flags and ABI compatibility. See the section
@@ -28,13 +31,11 @@ should be included as follow:
28
31
29
32
#include <json/json.h>
30
33
31
- If JsonCpp was build as a dynamic library on Windows, then your project needs to
34
+ If JsonCpp was built as a dynamic library on Windows, then your project needs to
32
35
define the macro ` JSON_DLL ` .
33
36
34
-
35
- Building and testing with new CMake
36
- -----------------------------------
37
-
37
+ Building and testing with CMake
38
+ -------------------------------
38
39
[ CMake] [ ] is a C++ Makefiles/Solution generator. It is usually available on most
39
40
Linux system as package. On Ubuntu:
40
41
@@ -75,10 +76,8 @@ the `-G` option).
75
76
By default CMake hides compilation commands. This can be modified by specifying
76
77
` -DCMAKE_VERBOSE_MAKEFILE=true ` when generating makefiles.
77
78
78
-
79
79
Building and testing with SCons
80
80
-------------------------------
81
-
82
81
** Note:** The SCons-based build system is deprecated. Please use CMake; see the
83
82
section above.
84
83
@@ -107,14 +106,7 @@ If you are building with Microsoft Visual Studio 2008, you need to set up the
107
106
environment by running ` vcvars32.bat ` (e.g. MSVC 2008 command prompt) before
108
107
running SCons.
109
108
110
-
111
- Running the tests manually
112
- --------------------------
113
-
114
- Note that test can be run using SCons using the ` check ` target:
115
-
116
- scons platform=$PLATFORM check
117
-
109
+ # Running the tests manually
118
110
You need to run tests manually only if you are troubleshooting an issue.
119
111
120
112
In the instructions below, replace ` path/to/jsontest ` with the path of the
@@ -137,20 +129,21 @@ In the instructions below, replace `path/to/jsontest` with the path of the
137
129
# You can run the tests using valgrind:
138
130
python rununittests.py --valgrind path/to/test_lib_json
139
131
132
+ ## Running the tests using scons
133
+ Note that tests can be run using SCons using the ` check ` target:
134
+
135
+ scons platform=$PLATFORM check
140
136
141
137
Building the documentation
142
138
--------------------------
143
-
144
139
Run the Python script ` doxybuild.py ` from the top directory:
145
140
146
141
python doxybuild.py --doxygen=$(which doxygen) --open --with-dot
147
142
148
143
See ` doxybuild.py --help ` for options.
149
144
150
-
151
145
Generating amalgamated source and header
152
146
----------------------------------------
153
-
154
147
JsonCpp is provided with a script to generate a single header and a single
155
148
source file to ease inclusion into an existing project. The amalgamated source
156
149
can be generated at any time by running the following command from the
@@ -172,10 +165,8 @@ The amalgamated sources are generated by concatenating JsonCpp source in the
172
165
correct order and defining the macro ` JSON_IS_AMALGAMATION ` to prevent inclusion
173
166
of other headers.
174
167
175
-
176
168
Adding a reader/writer test
177
169
---------------------------
178
-
179
170
To add a test, you need to create two files in test/data:
180
171
181
172
* a ` TESTNAME.json ` file, that contains the input document in JSON format.
@@ -195,10 +186,8 @@ The `TESTNAME.expected` file format is as follows:
195
186
See the examples ` test_complex_01.json ` and ` test_complex_01.expected ` to better
196
187
understand element paths.
197
188
198
-
199
189
Understanding reader/writer test output
200
190
---------------------------------------
201
-
202
191
When a test is run, output files are generated beside the input test files.
203
192
Below is a short description of the content of each file:
204
193
@@ -215,10 +204,7 @@ Below is a short description of the content of each file:
215
204
* ` test_complex_01.process-output ` : ` jsontest ` output, typically useful for
216
205
understanding parsing errors.
217
206
218
-
219
207
License
220
208
-------
221
-
222
209
See the ` LICENSE ` file for details. In summary, JsonCpp is licensed under the
223
210
MIT license, or public domain if desired and recognized in your jurisdiction.
224
-
0 commit comments