string areajson="[{"251139":"university_of_bath"},{"253980":"\u6cd5\u56fd\u5170\u65af\u7ba1\u7406\u5b66\u9662"},{"250362":"\u590d\u65e6\u5b66\u9662"}]"; JArray ja = JArray.Parse(areajson); if (ja != null) { foreach (JObject jo in ja) { Dictionary<string,string> values = JsonConvert.DeserializeObject<Dictionary<string,string>>(jo.ToString()); foreach (string key in values.Keys) { Response.Write(ja.Count+" key: "+key + " " + values[key] + "<br/>");//key是属性名,values[key]是属性的值}
}
}
}
如果当属性的名称不固定的时候,我们就不要获取属性的名称。