json例子:
{
"soap:Envelope": {
"-xmlns:soap": "http://schemas.xmlsoap.org/soap/envelope/",
"soap:Body": {
"ns2:GetRecipeResponse": {
"-xmlns:ns2": "http://webservice.controller.eip.wisdytech.com/",
"GetRecipeResult": {
"Code": "S",
"Msg": "成功",
"Data": {
"Version": "V2.0",
"LastUpdateOnTime": "2023/02/26 14:22:55",
"ParamList": {
"RecipeGetParamForEqu": [
{
"ParamCode": "SR2BM9902",
"ParamUpper": "20.0",
"ParamLower": "1.0"
},
{
"ParamCode": "SR2BM9901",
"ParamUpper": "20.0",
"ParamLower": "1.0"
}
]
}
}
}
}
}
}
}
dim xmlToJsonStr as string = ""
xmlDoc.LoadXml(restData) '将xml转json
xmlToJsonStr = JsonConvert.SerializeXmlNode(xmlDoc)
obj = JsonConvert.DeserializeObject(Of JObject)(xmlToJsonStr)
code = obj("soap:Envelope")("soap:Body")("ns2:GetRecipeResponse")("GetRecipeResult")("Code").ToString()
msg = obj("soap:Envelope")("soap:Body")("ns2:GetRecipeResponse")("GetRecipeResult")("Msg").ToString()
Version = obj("soap:Envelope")("soap:Body")("ns2:GetRecipeResponse")("GetRecipeResult")("Data")("Version").ToString()
LastUpdateOnTime = obj("soap:Envelope")("soap:Body")("ns2:GetRecipeResponse")("GetRecipeResult")("Data")("LastUpdateOnTime").ToString()
RecipeGetParamForEqu = obj("soap:Envelope")("soap:Body")("ns2:GetRecipeResponse")("GetRecipeResult")("Data")("ParamList")("RecipeGetParamForEqu").ToString()
vb 获取json嵌套的值
最新推荐文章于 2023-08-21 10:00:00 发布