layout: post
title: “C++ Json”
date: 2016-07-15 16:03
comments: true
tags:
- Json
- rapidjson
- JsonCpp
- ggicci–json
- nlohmann
- C++
- 随笔
C++中使用json
JsonCpp
下载:
https://github.com/open-source-parsers/jsoncpp
https://sourceforge.net/projects/jsoncpp/
https://github.com/open-source-parsers/jsoncpp/archive/1.7.4.zip
使用:
配置:
本人使用的是JsonCpp1.7.4,解压后直接把include与src复制到自己的项目下。
在项目中附加包含目录:../include;../src/lib_json;
把两个目录中的文件添加到项目中
json_reader.cpp、json_value.cpp和json_writer.cpp三个文件的预编译头改成“不使用预编译头”
代码:
Json::Value root; // will contains the root value after parsing.
Json::Reader reader;
bool parsingSuccessful = reader.parse( config_doc, root );
i