* Introduction:
=============
JSON (JavaScript Object Notation) 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.
JsonCpp (http://jsoncpp.sourceforge.net/) is a simple API to manipulate
JSON value, handle serialization and unserialization to string.
It can also preserve existing comment in unserialization/serialization steps,
making it a convenient format to store user input files.
Unserialization parsing is user friendly and provides precise error reports.
* Building/Testing:
=================
JsonCpp uses Scons (http://www.scons.org) as a build system. Scons requires
python to be installed (http://www.python.org).
You download scons-local distribution from the following url:
http://sourceforge.net/projects/scons/files/scons-local/1.2.0/
Unzip it in the directory where you found this README file. scons.py Should be
at the same level as README.
python scons.py platform=PLTFRM [TARGET]
where PLTFRM may be one of:
suncc Sun C++ (Solaris)
vacpp Visual Age C++ (AIX)
mingw
msvc6 Microsoft Visual Studio 6 service pack 5-6
msvc70 Microsoft Visual Studio 2002
msvc71 Microsoft Visual Studio 2003
msvc80 Microsoft Visual Studio 2005
msvc90 Microsoft Visual Studio 2008
linux-gcc Gnu C++ (linux, also reported to work for Mac OS X)
Notes: if you are building with Microsoft Visual Studio 2008, you need to
setup the environment by running vcvars32.bat (e.g. MSVC 2008 command prompt)
before running scons.
Adding platform is fairly simple. You need to change the Sconstruct file
to do so.
and TARGET may be:
check: build library and run unit tests.
* Running the test manually:
==========================
Notes that test can be run by scons using the 'check' target (see above).
You need to run test manually only if you are troubleshooting an issue.
In the instruction below, replace "path to jsontest.exe" with the path
of the 'jsontest' executable that was compiled on your platform.
cd test
# This will run the Reader/Writer tests
python runjsontests.py "path to jsontest.exe"
# This will run the Reader/Writer tests, using JSONChecker test suite
# (http://www.json.org/JSON_checker/).
# Notes: not all tests pass: JsonCpp is too lenient (for example,
# it allows an integer to start with '0'). The goal is to improve
# strict mode parsing to get all tests to pass.
python runjsontests.py --with-json-checker "path to jsontest.exe"
# This will run the unit tests (mostly Value)
python rununittests.py "path to test_lib_json.exe"
You can run the tests using valgrind:
python rununittests.py --valgrind "path to test_lib_json.exe"
* Building the documentation:
===========================
Run the python script doxybuild.py from the top directory:
python doxybuild.py --open --with-dot
See doxybuild.py --help for options.
Notes that the documentation is also available for download as a tarball.
The documentation of the latest release is available online at:
http://jsoncpp.sourceforge.net/
* Generating amalgamated source and header
========================================
JsonCpp is provided with a script to generate a single header and a single
source file to ease inclusion in an existing project.
The amalgamated source can be generated at any time by running the following
command from the top-directory (requires python 2.6):
python amalgamate.py
It is possible to specify header name. See -h options for detail. By default,
the following files are generated:
- dist/jsoncpp.cpp: source file that need to be added to your project
- dist/json/json.h: header file corresponding to use in your project. It is
equivalent to including json/json.h in non-amalgamated source. This header
only depends on standard headers.
- dist/json/json-forwards.h: header the provides forward declaration
of all JsonCpp types. This typically what should be included in headers to
speed-up compilation.
The amalgamated sources are generated by concatenating JsonCpp source in the
correct order and defining macro JSON_IS_AMALGAMATION to prevent inclusion
of other headers.
* Using json-cpp in your project:
===============================
include/ should be added to your compiler include path. jsoncpp headers
should be included as follow:
#include <json/json.h>
* Adding a reader/writer test:
============================
To add a test, you need to create two files in test/data:
- a TESTNAME.json file, that contains the input document in JSON format.
- a TESTNAME.expected file, that contains a flatened representation of
the input document.
TESTNAME.expected file format:
- each line represents a JSON element of the element tree represented
by the input document.
- each line has two parts: the path to access the element separated from
the element value by '='. Array and object values are always empty
(e.g. represented by either [] or {}).
- element path: '.' represented the root element, and is used to separate
object members. [N] is used to specify the value of an array element
at index N.
See test_complex_01.json and test_complex_01.expected to better understand
element path.
* Understanding reader/writer test output:
========================================
When a test is run, output files are generated aside the input test files.
Below is a short description of the content of each file:
- test_complex_01.json: input JSON document
- test_complex_01.expected: flattened JSON element tree used to check if
parsing was corrected.
- test_complex_01.actual: flattened JSON element tree produced by
jsontest.exe from reading test_complex_01.json
- test_complex_01.rewrite: JSON document written by jsontest.exe using the
Json::Value parsed from test_complex_01.json and serialized using
Json::StyledWritter.
- test_complex_01.actual-rewrite: flattened JSON element tree produced by
jsontest.exe from reading test_complex_01.rewrite.
test_complex_01.process-output: jsontest.exe output, typically useful to
understand parsing error.
* License
=======
See file LICENSE for details. Basically JsonCpp is licensed under
MIT license, or public domain if desired and recognized in your jurisdiction.
没有合适的资源?快使用搜索试试~ 我知道了~
jsoncpp不能正常解析,以及全角字符的问题,可以直接编辑使用.zip
共200个文件
json:83个
expected:46个
py:17个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 128 浏览量
2024-10-31
16:52:08
上传
评论
收藏 295KB ZIP 举报
温馨提示
jsoncpp不能正常解析,以及全角字符的问题,可以直接编辑使用.zip
资源推荐
资源详情
资源评论
收起资源包目录
jsoncpp不能正常解析,以及全角字符的问题,可以直接编辑使用.zip (200个子文件)
AUTHORS 49B
json_value.cpp 41KB
json_reader.cpp 21KB
json_writer.cpp 20KB
jsontest.cpp 13KB
main.cpp 13KB
main.cpp 7KB
UpgradeReport.css 3KB
jsoncpp.dox 5KB
roadmap.dox 2KB
test_large_01.expected 31KB
test_string_02.expected 2KB
test_array_05.expected 977B
test_complex_01.expected 358B
test_array_06.expected 190B
test_comment_01.expected 109B
test_string_01.expected 98B
test_object_03.expected 54B
test_array_04.expected 46B
test_array_03.expected 46B
test_string_03.expected 35B
test_string_unicode_05.expected 34B
test_preserve_comment_01.expected 27B
test_integer_07_64bits.expected 24B
test_integer_08_64bits.expected 24B
test_integer_06_64bits.expected 23B
test_object_02.expected 19B
test_real_06.expected 18B
test_real_07.expected 18B
test_basic_03.expected 17B
test_real_03.expected 17B
test_real_05.expected 17B
test_real_02.expected 17B
test_real_01.expected 16B
test_real_04.expected 15B
test_integer_02.expected 15B
test_basic_04.expected 14B
test_array_02.expected 14B
test_object_04.expected 14B
test_integer_01.expected 14B
test_basic_02.expected 14B
test_integer_03.expected 14B
test_basic_01.expected 13B
test_basic_07.expected 11B
test_string_unicode_04.expected 10B
test_basic_05.expected 10B
test_basic_06.expected 10B
test_basic_08.expected 10B
test_basic_09.expected 10B
test_string_unicode_03.expected 9B
test_string_unicode_02.expected 8B
test_integer_04.expected 7B
test_integer_05.expected 7B
test_string_unicode_01.expected 7B
test_object_01.expected 6B
test_array_01.expected 6B
UpgradeReport_Plus.gif 71B
UpgradeReport_Minus.gif 69B
value.h 35KB
jsontest.h 9KB
reader.h 7KB
writer.h 7KB
json_batchallocator.h 4KB
config.h 3KB
json_tool.h 3KB
features.h 2KB
forwards.h 1001B
autolink.h 664B
json.h 426B
footer.html 572B
header.html 566B
doxyfile.in 64KB
json_internalmap.inl 16KB
json_internalarray.inl 13KB
json_valueiterator.inl 7KB
test_large_01.json 9KB
test_string_02.json 2KB
pass1.json 1KB
test_array_05.json 387B
test_complex_01.json 264B
test_preserve_comment_01.json 220B
test_array_06.json 176B
test_comment_01.json 158B
pass3.json 148B
test_string_01.json 100B
test_real_02.json 74B
test_real_03.json 74B
test_object_03.json 69B
test_real_01.json 65B
fail1.json 60B
fail10.json 58B
pass2.json 52B
fail18.json 50B
fail13.json 43B
fail32.json 40B
fail26.json 38B
test_string_03.json 38B
fail3.json 37B
test_integer_03.json 37B
test_integer_02.json 36B
共 200 条
- 1
- 2
资源评论
GZM888888
- 粉丝: 511
- 资源: 3067
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Java项目: 基于springBoot+mysql+maven+vue疫情隔离管理系统(含源码+数据库)
- 自定义注解实现AES接口响应数据加密
- 前端单页面的列表增删改查,使用Vue(类库使用)+bootstrap4+Mockjs+jQuery
- springboot学生网上请假系统设计与实现.zip
- nginx 自启动的资源依赖包,windows环境
- 计算机毕业设计:python+爬虫可视化
- C++基础知识-String 和 character literals.pdf
- springboot大型商场应急预案管理系统.zip
- CSS3会发光的南瓜灯动画特效
- springboot健身房管理系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功