C++程序、JSON阅读器和摘录
C++ program, JSON reader and extract.
我正在处理一个赋值,它必须读取一个json文件并将其存储在字符串缓冲区数组中。使用structCollection来收集对象、名称和值对。
示例JSON:
0 {
1 "Obj": {
2 "Hello": "working",
3 "Test": "working"
4 }
我可以提取它,并将其存储在结构Collection中。我正在使用:(在循环中)
if(buffer[line_number].find('{')!=string::npos) {
然后使用substr来存储它。
问题是,如果"{"包含在对象或名称值对中,这将不允许。
{
"Obj": {
"Hello": "Working {Not working}"
}
{数值中的contians。
struct Collection {
string ObjName;
string name[50];
string Value[50]
}
我知道,这个问题很老,但请尝试使用github。有很多很酷的解析器
https://github.com/search?l=C%2B%2B&o=desc&q=json&s=星形&type=存储库&utf8=%E2%9C%93
甚至我的:https://github.com/kurzgame/json-to-map
相关文章:
- Mongodb c++驱动程序:如何查询元素的数组
- C++,系统无法执行指定的程序
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- 在c++中使用nlohmann从类到json的转换
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- C++ Windows 驱动程序MSB3030无法复制该文件,因为它找不到
- 重载操作程序时出错>>用于类中的字符串 memebr
- 获取日期异步信号安全吗?如果在信号处理程序中使用,它会导致死锁吗
- 试图在visual studio上用C++创建一个桌面应用程序
- 模板元程序查找相似的连续类型名称
- FFmpeg:制作一个应用程序比直接使用ffmepg更好吗
- 如何通过cpp程序运行shell脚本
- 有没有什么方法可以使用一个函数中定义的常量变量,也可以由c++中同一程序中的其他函数使用
- IPC使用多个管道和分支进程来运行Python程序
- C++ 使用 json 文件提升程序选项
- 如何将C++应用程序与节点.js服务器连接以获取 JSON 数据
- 如何将JSON数组存储在Arduino程序中
- C++json反序列化程序
- C++程序、JSON阅读器和摘录
- 接收JSON并写入数据库的c++应用程序