我该如何解析json库? [英] How can I parse json library?

查看:87
本文介绍了我该如何解析json库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我正在用c ++解析json。

json格式是

Hello. I am working on parsing json in c++.
json format is

{
{
"product":"12456",
"variant":"5698"
}
,
{
"product":"124565",
"variant":"5698"
}
,
{
"product":"124565",
"variant":"12456"
}
}





我找不到json解析器库可以解析那个格式的json。



帮助我。



提前致谢。



我试过的:



我试过jsoncpp-master,rapidson-master,restful-mapper-master

cpprestsdk-master。



I can't find json parser library can parse that format json.

Help me.

Thanks in advance.

What I have tried:

I tried with jsoncpp-master, rapidson-master, restful-mapper-master
cpprestsdk-master.

推荐答案

你的json应该以[]而不是{}开头和结尾: JSONLint - JSON Validator。 [ ^ ]

Your json should begin and end in [ ] not { } : JSONLint - The JSON Validator.[^]
[
{
"product":"12456",
"variant":"5698"
}
,
{
"product":"124565",
"variant":"5698"
}
,
{
"product":"124565",
"variant":"12456"
}
]


Quote:

{
{
"product":"12456",
"variant":"5698"
}
,
{
"product":"124565",
"variant":"5698"
}
,
{
"product":"124565",
"variant":"12456"
}
}



可能所有图书馆同意您的数据不是JSON格式。


May be all libraries agree that your data is not JSON format.


这篇关于我该如何解析json库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆