和proto与xml类似,json也是一种数据交换格式,它简洁易用,所以受到大家的推崇,在游戏服务器中也有所应用,比如说idip,邮件等。基本用法为,先把数据保存在Json中,然后再在使用的一方读取出来,例如:
//保存侧
Json::Value root;
root["1"] = 1;
root["2"] = 2;
string str = root.toStyledString();
//使用侧
Json::Value root;
Json::Reader reader;
if (reader.parse(str, root))//上面提到的str
{
int value1 = root["1"].asInt();
int value2 = root["2"].asInt();
}
Json的安装:
https://www.jianshu.com/p/b4cedc429842
https://www.cnblogs.com/yuanzhifei/p/9513277.html
Json安装遇到的问题:
https://blog.csdn.net/doc_sgl/article/details/8770234/
http://www.downyi.com/downinfo/174278.html
https://blog.csdn.net/weixin_41147129/article/details/89605465
https://blog.csdn.net/flyyufenfei/article/details/72780026
https://blog.csdn.net/xianhua7877/article/details/80815253
https://blog.csdn.net/byxdaz/article/details/80392917
Json的使用
https://blog.csdn.net/admin_maxin/article/details/53175779?utm_source=copy
https://blog.csdn.net/OO_SEN/article/details/98480848
https://blog.csdn.net/Wu_Yimin/article/details/92838748
https://www.cnblogs.com/lidabo/p/9436217.html
https://blog.csdn.net/LL596214569/article/details/85221694
https://www.cnblogs.com/ZY-Dream/p/10054074.html