Skip to content

Commit 876643f

Browse files
committed
update readme
1 parent 7325ed0 commit 876643f

File tree

7 files changed

+63
-9
lines changed

7 files changed

+63
-9
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
# cppjson
2-
a light json lib using c++20
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)
33

4+
这是一个使用C++17开发的JSON库。使用MIT协议。
5+
它支持UTF-8编码格式。
6+
7+
### 如何使用?
8+
cppjson支持从json文件读取数据然后进行解析,详情请见`testexpamle1.json`文件。
9+
如果你使用了`testexample1.json`文件,如`main.cpp`所示,便可以进行解析,得到以下输出结果。
10+
11+
![image](cpp_json/images/文件读取序列化.png)
12+
13+
cppjson还支持反序列化操作,即将
14+
15+
### external中的文件
16+
`external`中包含`googletest``benchmark`两个文件夹,对你而言可能并没有帮助,因为它仅作为测试编写以及
17+
基准测试而引入,删除`external`并不影响该库的使用。如有需要,可以删除
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Start testing: Apr 02 11:16 CST
1+
Start testing: May 15 15:16 CST
22
----------------------------------------------------------
3-
End testing: Apr 02 11:16 CST
3+
End testing: May 15 15:16 CST

cpp_json/cmake-build-debug/cpp_json

-27.7 KB
Binary file not shown.
18.9 KB
Loading

cpp_json/main.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77
int main() {
88
JSON::json j, j2;
99
Jsonparser::parser p(j);
10-
p.parse_file("testexample1.json"); //you should use absolute path better.
11-
//p.parse("1.4");
12-
//cout << j.get_number() << endl;
10+
p.parse_file("../../cpp_json/testexample1.json");
1311
Jsonparser::parser p2(j2);
14-
cout << j.get_type_format() << ' ' << endl;
15-
Jsonstringifier::stringifier g;
16-
cout << g.stringify(j);
12+
//cout << j.get_type_format() << ' ' << endl;
13+
//Jsonstringifier::stringifier g;
14+
//cout << g.stringify(j);
1715
return 0;
1816
}

cpp_json/testexample2.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"{\n"
2+
" \"name\": \"vue_test\",\n"
3+
" \"version\": 1.4,\n"
4+
" \"private\": true,\n"
5+
" \"scripts\": {\n"
6+
" \"serve\": \"vue-cli-service serve\",\n"
7+
" \"build\": \"vue-cli-service build\",\n"
8+
" \"lint\": \"vue-cli-service lint\"\n"
9+
" },\n"
10+
" \"dependencies\": {\n"
11+
" \"core-js\": \"^3.6.5\",\n"
12+
" \"vue\": \"^2.6.11\"\n"
13+
" },\n"
14+
" \"devDependencies\": {\n"
15+
" \"@vue/cli-plugin-babel\": \"~4.5.0\",\n"
16+
" \"@vue/cli-plugin-eslint\": \"~4.5.0\",\n"
17+
" \"@vue/cli-service\": \"~4.5.0\",\n"
18+
" \"babel-eslint\": \"^10.1.0\",\n"
19+
" \"eslint\": \"^6.7.2\",\n"
20+
" \"eslint-plugin-vue\": \"^6.2.2\",\n"
21+
" \"vue-template-compiler\": \"^2.6.11\"\n"
22+
" },\n"
23+
" \"eslintConfig\": {\n"
24+
" \"root\": true,\n"
25+
" \"env\": {\n"
26+
" \"node\": true\n"
27+
" },\n"
28+
" \"extends\": [\n"
29+
" \"plugin:vue/essential\",\n"
30+
" \"eslint:recommended\"\n"
31+
" ],\n"
32+
" \"parserOptions\": {\n"
33+
" \"parser\": \"babel-eslint\"\n"
34+
" },\n"
35+
" \"rules\": {}\n"
36+
" },\n"
37+
" \"browserslist\": [\n"
38+
" \"> 1%\",\n"
39+
" \"last 2 versions\",\n"
40+
" \"not dead\"\n"
41+
" ]\n"
42+
"}"

0 commit comments

Comments
 (0)