Skip to content

Commit 7176daa

Browse files
author
twoone3
committed
update README
1 parent 75d5dfc commit 7176daa

File tree

8 files changed

+801
-860
lines changed

8 files changed

+801
-860
lines changed

.clang-format

Lines changed: 0 additions & 44 deletions
This file was deleted.

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
# json
2-
方便的c++JSON库<br>
2+
使用 C++ 特性编写的 JSON 库
33
[简体中文](README.md) | [English](README_EN.md)
4+
5+
# 前言
6+
为什么要写这样一个JSON库?github上目前有很多大型的JSON解析库,如RapidJSON、jsoncpp、nlohmann_json,但由于历史等不可抗力原因,它们有着各自的缺点与不足,各种繁多的代码堆积,导致维护困难,我致力于打造一个代码最简单,速度快,便携的JSON库。
7+
48
# 特点
5-
1. 简单易用
6-
2. 内存友好
7-
3. 效率高
8-
4. 支持解析时报错
9+
1. 百般打磨的API
10+
2. 使用std::variant进行操作,内存友好
11+
3. 拥有比nlohmann稍高的效率
12+
4. 代码遵循`Google C++ Style`
13+
914
# 用法
10-
1. 将json.cpp和json.h添加到你的项目
11-
2. 将项目的语言标准调整到c++17
12-
3. 包括json.h文件
13-
4. 接下来就可以使用本json库了
15+
1. `json.cpp``json.h`添加到你的项目
16+
2. 将项目的语言标准调整到`c++17`或者更新的版本
17+
3. 在你的`.c`或者`.cpp`文件包括`json.h`
18+
1419
# 文档
1520
## 主要类
1621
* Value
@@ -33,6 +38,7 @@ cout << w.getOutput() << endl;
3338
```
3439
当然你也可以用Value::dump()来实现此功能
3540
如果要配置序列化模式,就得用此例子
41+
3642
# 参考
3743
https://github.com/jo-qzy/MyJson/
3844
https://github.com/open-source-parsers/jsoncpp

README_EN.md

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,48 @@
11
# json
2-
Convenient c++JSON library<br>
2+
JSON library written with C++ features
33
[简体中文](README.md) | [English](README_EN.md)
4+
5+
# Preface
6+
Why write such a JSON library? github currently has a lot of large JSON parsing library, such as RapidJSON, jsoncpp, nlohmann_json, but due to history and other force majeure reasons, they have their own shortcomings and shortcomings, a variety of a wide range of code pile up, resulting in maintenance difficulties, I am committed to creating a code the most simple, fast, portable JSON library. Fast, portable JSON library.
7+
48
# Features
5-
1. Simple and easy to use
6-
2. Memory friendly
7-
3. High efficiency
8-
4. Supports error reporting when parsing
9+
1. a hundred polished API
10+
2. use std::variant for operations, memory-friendly
11+
3. has a slightly higher efficiency than nlohmann
12+
4. The code follows `Google C++ Style`
13+
14+
# Usage
15+
1. add `json.cpp` and `json.h` to your project
16+
2. adjust the project's language standard to `c++17` or newer
17+
3. Include `json.h` in your `.c` or `.cpp` file
18+
19+
# Documentation
20+
## Main classes
21+
* Value
22+
Used to store, query and modify JSON data
23+
* Parser
24+
Used to parse a JSON string into Value
25+
```cpp
26+
Parser p.
27+
Value v.
28+
if (!p.parse(s, v))
29+
cout << p.getError() << endl.
30+
```
31+
* Writer
32+
Used to serialize Value objects into JSON strings
33+
```cpp
34+
Writer w.
35+
Value v.
36+
w.writeValue(v).
37+
cout << w.getOutput() << endl.
38+
```
39+
Of course you can also use Value::dump() for this function
40+
If you want to configure serialization mode, you have to use this example
41+
942
# Reference
1043
https://github.com/jo-qzy/MyJson/
1144
https://github.com/open-source-parsers/jsoncpp
1245
https://github.com/nlohmann/json
46+
47+
48+
Translated with www.DeepL.com/Translator (free version)

0 commit comments

Comments
 (0)