{
"Room" : {
"GJAerialView" : "industrial park base,"
"L02Room" : "display assembly workshop,"
"MRoom" : "MI workshop,"
"SMTRoom" : "the SMT workshop,"
"SL03Room" : "multi-functional product assembly workshop,"
"Unknown" : "not configured workshop"
},
"Room1" : {
1 "" GJAerialView1" : "industrial park base,
"L02Room1" : "display assembly workshop 1
"}...
}
Json file fragments as
How we by passing in the background of the key (such as providing the first parameter room. GJAerialView routine returns "industrial base", room1. L02Room1 return "1" display assembly workshop)
keep in mind that don't use recursive
CodePudding user response:
Online, such as recursive has achieved,
The first method segment code is as follows (length is introduced into the key according to the '. 'to split the length of the array)
for (int i=0; I & lt; Length; I++)
{
//if it is the first layer, then according to the above the top key for read out the json string
If (I==0)
{
Value_zh_cn=GetJsonStringOrValue (str_zh_cn_json, arrKey [I]);
Value_en=GetJsonStringOrValue (str_en_json, arrKey [I]);
}
Else//if the first layer, then according to the child the key to obtain the above json string or read out values
{
Value_zh_cn=GetJsonStringOrValue (value_zh_cn as string, arrKey [I]);
Value_en=GetJsonStringOrValue (value_en as string, arrKey [I]);
}
}
Public static object GetJsonStringOrValue (string input_json, string key)
{
If (String. IsNullOrEmpty (input_json) | | String. IsNullOrEmpty (key))
Return a string. The Empty;
Input_json=input_json. Replace (" \ r \ n ", string. The Empty);
JavaScriptSerializer serializer=new JavaScriptSerializer ();
DictionaryJson=serializer. DeserializeObject (input_json) as Dictionary ;
//here the manager said that the object can be directly take the path of key
The object value.
Json. TryGetValue (key, value) out;
Value=https://bbs.csdn.net/topics/serializer.Serialize (value);
The return value.
}
CodePudding user response:
In fact, I think it's turn objects can also be,,,,But if you just try out data, then jobject
CodePudding user response:
As for how to decompose room. GJAerialViewThis is not,
CodePudding user response:
Regular expression match wellCodePudding user response:
Still thinkPeople choose lenovo according to CSS out of the jquery selector