???C++????JSON??????????
???????????? ???????[ 2014/10/20 14:45:50 ] ??????????????? C++ JSON ???????
????2??Writer
??????????? Json::Value ????÷?????????ò??????????????????? json ????????Writer ??????
????Jsoncpp ?? Json::Writer ????????????????????????á??????????? Json::Writer ??????Json::FastWriter??Json::StyledWriter??Json::StyledStreamWriter??
??????????壬?? Json::FastWriter ?????? json ???????????????????????
????Json::FastWriter fast_writer;
????std::cout << fast_writer.write(root) << std::endl;
?????????????
????{"key_array":["array_string"??1234]??"key_boolean":false??"key_double":12.3450??"key_number":12345??"key_object":{"age":26??"name":"huchao"}??"key_string":"value_string"}
??????ι?????壬?? Json::StyledWriter ????????? json???????????????? Json::StyledWriter ????θ???????
????Json::StyledWriter styled_writer;
????std::cout << styled_writer.write(root) << std::endl;
?????????????
{
"key_array" : [ "array_string"?? 1234 ]??
"key_boolean" : false??
"key_double" : 12.3450??
"key_number" : 12345??
"key_object" : {
"age" : 26??
"name" : "huchao"
}??
"key_string" : "value_string"
}
????3??Reader
????Json::Reader ????????????????е????????????????? Json::Value ??????????????????????????????
????Json::Reader reader;
????Json::Value json_object;
????const char* json_document = "{/"age/" : 26??/"name/" : /"huchao/"}";
????if (!reader.parse(json_document?? json_object))
????return 0;
????std::cout << json_object["name"] << std::endl;
????std::cout << json_object["age"] << std::endl;
?????????????
????"huchao"
????26
???????????????????????????? json ???????
????4????????δ??????????????Json?е??
std::string test = "{"test":5??
"Value":{"version":"this is version"}}";
Json::Reader reader;
Json::Value value;
if(reader.parse(test??value))
{
int i = 0;
bool isNull = value["test"].isNull();
if(!isNull)
i = value["test"].asInt();
if(!value["Value"]["version"].isNull())
{
std::string str = value["Value"]["version"].asString();
}
Json::Value val1= value["OtherKey"];
if(!val1.isNull())
{
i = val1.asInt();
}
}
????--------------------------------------
????[1]??????????????????????????????????project?????????????????????????????????????????????????????????á?
????[2]????????????????????????????????????????? VS ??????project??????????Project --> Properties?н??ж????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??C++????????????C++ lvalue??rvalueC++11????????C++???????????????C++?е?????????????????C++?????????C++???Windows????λ??C/C++???????????????????JAVA??C??C++??????????c++??python???????????????????????????????C++???????C++?е????????C++????????????????C++ ???????????????C++?????????????????????C++????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????