1 Star 3 Fork 1

Asciphx / FuckJSON

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.cc 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
Asciphx 提交于 2022-07-01 15:31 . update v2.3
#include "module.hpp"
/* FuckJSON https://github.com/asciphx/FuckJSON Copyright (c) 2021-2022 Asciphx */
//Many to many
int main() {
Tab t{ 1, true, "reflect🪂", now(), vector<Type>{ Type{ 1,"model🦼" } }, Type{ 2,"👔" } };
std::string s; s << &t;//Support direct conversion of class or struct to JSON string
std::cout << s << '\n';//or cout << t << '\n';
json::parse(t, R"(
{
"id": 3,
"ok": false,
"name": "FuckJSON🛬",
"date": "2021-09-08 01:04:30",
"types": [{
"id": 1,
"language": "c++🏎"
}, {
"id": 2,
"language": "js🛺",
"tabs": [{
"id": 1,
"name": "faker🛴"
}, {
"id": 2,
"name": "bonkers🚒"
}]
}, {
"id": 3,
"language": "rust🚟"
}],
"type": {
"id": 1,
"language": "c++🏎"
}
}
)");
t.types[1].language = "go programing";
t.types[1].tabs[0].name = "Megatron🛹";
t.types[1].tabs[0].types = vector<Type>{ Type{ 1,"typescript🚁" }, Type{ 2,"best in the universe" } };
std::cout << json(t).dump(2) << '\n';
return 0;
}
C++
1
https://gitee.com/ASCIPHX/FuckJSON.git
git@gitee.com:ASCIPHX/FuckJSON.git
ASCIPHX
FuckJSON
FuckJSON
master

搜索帮助