tjchbs
长老_亮哥
采纳率100%
2016-12-12 03:05 阅读 2.7k

C# 反序列化嵌套JSON。请问这个JSON C#怎么来处理

5

{"total":1,"success":true,"metaData":{"fields":[{"name":"presno","type":"string"},{"name":"medid","type":"float"},{"name":"medouttime","type":"date","dateFormat":"Y-m-d H:i:s.u"},{"name":"prestype","type":"float"},{"name":"windowno","type":"string"},{"name":"patientid","type":"float"},{"name":"patientname","type":"string"},{"name":"patientsex","type":"string"},{"name":"patientbirth","type":"string"},{"name":"diagnosis","type":"string"},{"name":"wardno","type":"float"},{"name":"wardname","type":"string"},{"name":"doctorname","type":"string"},{"name":"fpno","type":"string"},{"name":"sendflag","type":"string"},{"name":"tfcode","type":"int"},{"name":"medpresinfo","type":"string"}]},"rows":[{"presno":"19840491","medid":40491,"medouttime":"2016-11-29 07:15:48.269085","prestype":1,"windowno":"","patientid":42361,"patientname":"陈诗玉","patientsex":"","patientbirth":"","diagnosis":"","wardno":10153,"wardname":"急诊科","doctorname":"周耀亮","fpno":"35654","sendflag":"","tfcode":1,"medpresinfo":"[{\"medid\":40491,\"medonlycode\":2119,\"medamt\":1,\"medpack\":\"\",\"medunitpack\":\"\",\"medunit\":\"0.125g*12s\",\"windowno\":\"\",\"medpredos\":\"0.5\",\"medusage\":\"qd\",\"medpreday\":1,\"medunitprice\":46.3000,\"medtotalprice\":\"\",\"medtype\":\"\",\"medconvercof\":\"\",\"tfcode\":\"\",\"medname\":\"地红霉素肠溶片(派盛)\",\"medfactory\":\"西安利君制药\"}]"}],"processedTime":43}

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • 已采纳
    showbo GoCityPass新加坡曼谷通票 2016-12-12 03:16
    点赞 评论 复制链接分享
  • hehexiaoxia hehexiaoxia 2016-12-12 03:05

    newstonsoft.json.dll
    定义一个结构相同的结构体,然后用json.convert转换成对应的结构体。

    点赞 评论 复制链接分享
  • tjchbs 长老_亮哥 2016-12-12 03:16

    这种即包含双引号又包含转义符的Json C#里貌似不太好处理,如果统一 replace 的话Json校验会失败,提示“RangeError: Invalid array length”,如果不进行转义又没法toString

    点赞 评论 复制链接分享
  • tjchbs 长老_亮哥 2016-12-14 09:48

    解决了。第一次接触JSON有些晕

    点赞 评论 复制链接分享

相关推荐