json解析问题

时间:2010-03-17 21:44:59

标签: json parsing

我有以下Json:

  

“{\” DOC \ “:{\” 信息\ “:{\” allowDistribution \ “:\” 真\”,\ “allowSearch \”:\ “真\”,\ “calaisRequestID \”:\ “67a02f61-7e45-cfc4-1276-e123c5f7422f \”,\ “外部ID \”:\ “\” \ “ID \”:\ “http://id.opencalais.com/dBo1YRiQeqS-kfO-m9UeWA \”,\ “的docId \”:\“{{ 3}} \“,\”document \“:\”你听什么类型的音乐?你需要支付多少钱?你还买cds吗?你喜欢夏奇拉吗?你听什么类型的音乐?\“,\”docTitle \“:\”\“,\”docDate \“:\”2010-03-17 17:40:41.323 \“,\”externalMetadata \“: \ “\” \ “提交\”:\ “\”},\ “元\”:{\ “的contentType \”:\ “文本/生\”,\ “emVer \”:\“7.1.1103.5 \ “,”langIdVer \“:\”DefaultLangId \“,\”processingVer \“:\”CalaisJob01 \“,\”submitionDate \“:\”2010-03-17 17:40:41.183 \“,”“submitterCode \ “:\” b54c734e-b865-185b-c83a-66e1c66272de \”,\ “签名\”:\ “digestalg-1 | FXnvwLovOsqVoSPX0JfGvj3tp7s = | cyV2tZWY9OXG1RBO0SuND4kd3Pkvqv0cS2YpsEBQhXDfSV4KoE61sQ == \”,\ “语言\”:\ “英文\”, \ “消息\”:[]}},\ “http://d.opencalais.com/dochash-1/8edabb36-eece-3f67-b187-ab64cd885ecb \”:{\ “_ typeGroup \”:\ “主题\”,\ “类别\”:\ “http://d.opencalais.com/dochash-1/8edabb36-eece-3f67-b187-ab64cd885ecb/cat/1 \”, \ “classifierName \”:\ “加莱\”,\ “类别名称\”:\ “Entertainment_Culture \”,\ “分数\”:1},\ “http://d.opencalais.com/cat/Calais/EntertainmentCulture \”:{\ “_ typeGroup \”: \“主题\”,\“category \”:\“http://d.opencalais.com/dochash-1/8edabb36-eece-3f67-b187-ab64cd885ecb/cat/2 \”,\“classifierName \”:\“Calais \”,\“categoryName \”:\“Human Interest \”,\“得分\ “:1},\”http://d.opencalais.com/cat/Calais/HumanInterest \ “:{\” _ typeGroup \ “:\” 主题\”,\ “类别\”:\ “http://d.opencalais.com/dochash-1/8edabb36-eece-3f67-b187-ab64cd885ecb/cat/3 \”,\ “classifierName \” :\ “加莱\”,\ “类别名称\”:\ “Technology_Internet \”,\ “分数\”:0.932}}“

请告诉我为什么不解析这个?

这是我的代码:

JObject o = JObject.Parse(json);
String category = (string)o["doc"]["_typeGroup"]["categoryName"];

它告诉我:

  

对象引用未设置为对象的实例。

谢谢:)

1 个答案:

答案 0 :(得分:2)

_typeGroup不在doc下,但实际上在http://d.opencalais.com/dochash-1/8edabb36-eece-3f67-b187-ab64cd885ecb/cat/1下,categoryName也是如此。