File tree Expand file tree Collapse file tree 6 files changed +12
-8
lines changed Expand file tree Collapse file tree 6 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 1
1
# cppjson
2
2
![ ] ( https://img.shields.io/github/license/mashape/apistatus ) ![ ] ( https://img.shields.io/github/stars/coderhare/cppjson?style=social ) ![ ] ( https://img.shields.io/powershellgallery/p/DNS.1.1.1.1 )
3
3
4
- 这是一个使用C++17开发的JSON库。使用MIT协议。
5
- 它支持UTF-8编码格式。
4
+ 这是一个使用C++开发的JSON库。使用MIT协议。
5
+
6
+ 它支持主流的` UTF-8 ` 编码格式。
6
7
7
8
### 如何使用?
8
9
cppjson支持从json文件读取数据然后进行解析,详情请见` testexpamle1.json ` 文件。
9
10
如果你使用了` testexample1.json ` 文件,如` main.cpp ` 所示,便可以进行解析,得到以下输出结果。
10
11
11
12
![ image] ( cpp_json/images/文件读取序列化.png )
12
13
13
- cppjson还支持反序列化操作,即将
14
+ cppjson还支持` strinify ` 操作,即将JSON对象转换为JSON文本。
15
+ 详情可见` main.cpp ` 里头的注释部分。该部分即是将解析过的JSON对象重新转换为对应的JSON文本。
16
+ 结果如下,
17
+ ![ image] ( cpp_json/images/stringify.png )
14
18
15
19
### external中的文件
16
20
` external ` 中包含` googletest ` 和` benchmark ` 两个文件夹,对你而言可能并没有帮助,因为它仅作为测试编写以及
Original file line number Diff line number Diff line change 1
- Start testing: May 15 15:16 CST
1
+ Start testing: May 15 15:32 CST
2
2
----------------------------------------------------------
3
- End testing: May 15 15:16 CST
3
+ End testing: May 15 15:32 CST
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ int main() {
9
9
Jsonparser::parser p (j);
10
10
p.parse_file (" ../../cpp_json/testexample1.json" );
11
11
Jsonparser::parser p2 (j2);
12
- // cout << j.get_type_format() << ' ' << endl;
13
- // Jsonstringifier::stringifier g;
14
- // cout << g.stringify(j);
12
+ cout << j.get_type_format () << ' ' << endl;
13
+ Jsonstringifier::stringifier g;
14
+ cout << g.stringify (j);
15
15
return 0 ;
16
16
}
You can’t perform that action at this time.
0 commit comments