赞
踩
Last Update: 2012-12-20 -> 2013-09-23
Description:
jsoncpp is an implementation of a JSON (http://json.org) reader and writer in C++. JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.
反面观点:
Posted by OpenID User — 2012-03-14 It's really good apart from the lack of UNICODE support, I'd have to change everything to TCHAR and std::wstring :(
Posted by Sergey Kolomenkin — 2011-02-09 It corrupts heap memory! Developers don't correct even critical bugs for a months (see bug list).
Posted by hypernewbie — 2010-06-16 absolutely horrendous. making a Json::Value global would result in a pure virtual function call crash upon exit. If you try asInt() when the value is a string, you'd get a huge assertion fail. Random access violations everywhere.
网友经验:
1.《json笔记-jsoncpp一个全局对象的bug》,指出由于全局对象构造和析构时可能引发崩溃的问题。2.《C++ Json》,文档整理的比较干净,对 Value 值类型详细进行了代码举例。
3.《JsonCpp使用优化》,从 编译、使用方式、代码,以及编译成哪种库几方面说明优化问题。
4.《JsonCpp简介》,可以看下工程组织方式,和测试例子。
实践经验:
1.解压后的包内容如下:
2.查看 README 文件,并按其中的要求下载并安装配置 scons-local 和 python 。其中 scons-local 解压后,令 scons.py 与 README 位于同级目录。如下图:
3.执行工程配置和编译命令:
1
|
python scons.py platform
=
PLTFRM [TARGET]
|
1
2
3
4
5
6
7
8
9
|
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
linux-
gcc
Gnu C++ (linux, also reported to work
for
Mac OS X)
|
1
2
|
and TARGET may be:
check: build library and run unit tests.
|
4.执行命令后的结果,如下图:
==================================
Last Update: 2012-12-09 -> 2013-10-09
README.md
Very low footprint JSON parser written in portable ANSI C. BSD licensed with no dependencies (i.e. just drop the C file into your project) Never recurses or allocates more memory than it needs Very simple API with operator sugar for C++
个人总结:
1.目录结构
2.提供的 API
json_parse 封装了对 json_parse_ex 的调用
1
|
json_value * json_parse(
const
json_char * json);
|
json_parse_ex 封装了对 new_value 和 json_value_free 的调用
1
2
|
json_value * json_parse_ex(json_settings * settings,
const
json_char * json,
char
* error);
|
1
2
|
static
int
new_value(json_state * state, json_value ** top,
json_value ** root, json_value ** alloc, json_type type);
|
1
|
void
json_value_free(json_value *);
|
1
|
static
void
* json_alloc(json_state * state, unsigned
long
size,
int
zero);
|
==================================
Last Update: 2012-11-16 -> 无更新
Description
Rapidjson is an attempt to create the fastest JSON parser and generator.
其他网友的点评:《推荐一款cpp解析json工具-rapidjson》
其中给出的结论如下。
优点:
缺点:
库作者同时提供了比较详细的用户手册供参考。
最后引用一段用户手册中的说明:
rapidjson is a header-only library. That means, the only thing to be done is to copy rapidjson/include/rapidjson and its sub-directories to your project or other include paths.
==================================
Overview
JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C, output them as JSON formatted strings and parse JSON formatted strings back into the C representation of JSON objects.
==================================
Last Update: 2011-10-10 -> 2013-08-19
Description
An ultra-lightweight, portable, single-file, simple-as-can-be ANSI-C compliant JSON parser, under MIT license.
反面观点:
Posted by zhou meng — 2010-04-13 Lightweight, easy to use and well documented. Good work! Only not support wide byte like japanese,chinese
Posted by Otto Linnemann — 2010-01-24 Lightweight, easy to use and well documented. Good work! Only memory management should be improved!
【ninja9578/libjson_7.6.1.zip】
Last Update: 2012-06-25 -> 没有更新
Description
A JSON reader and writer which is super-effiecient and usually runs circles around other JSON libraries. It's highly customizable to optimize for your particular project, and very lightweight. For Windows, OSX, or Linux. Works in any language.
Features
反面意见:
Posted by hu junjie — 2011-07-14case JSON_TEXT('\v'): //vertical tab res += JSON_TEXT("\\v"); break; case JSON_TEXT('\''): //apostrophe res += JSON_TEXT("\\\'"); break; in rfc4627, '\v', '\'' NOT NEED escape, if do this, other jsonlib will crash, ex: jsoncpp..2:
json SHOULD transfer in utf8, if define UNICODE, will transfer unicode, if not define UNICODE, libjson can not parse string contant \uxxyy when xx not equ 03:
in code JSONWork.cpp *runner++ = (*++p == JSON_TEXT('\"')) ? JSON_TEXT('\1') : *p; //an escaped quote will reak havoc will all of my searching functions, so change it into an illegal character in JSON for convertion later on but iif the node no fetch yet, will not convertion later on, for example: const char *str = "{ \"mt\":\"\\\"str\\\"\" }" // str={"mt":"\"str\""} JSONNode obj = libjson::parse(str); json_string objstr = obj.write(); printf("%s\n", objstr.c_str()); WILL OUTPUT {"mt","\1str\1"}
=============================================
另外,有网友专门对 C 代码的 JSON 解析库进行了比较,参考文章:《四种json c parser的兼容性比较》。
其给出的结论如下:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。