日期:2014-05-17  浏览次数:20622 次

求以下无KEY的JSON数据反序列化
数据如下:
  
{
  "code": 200,
  "status": "OK",
  "result": "{\"0130513113839835855\":{\"PassengerID\":\"3f4124f7-e68d-400a-823f-f9eb506856a7\",\"PassengerName\":\"吉吉\",\"TicketNumber\":\"\"}}"
}



我在做的时候,不知道对"0130513113839835855\"  怎么处理了
json 行业数据 C# asp.net

------解决方案--------------------
{
  "code": 200,
  "status": "OK",
  "result": "{\"0130513113839835855\":{\"PassengerID\":\"3f4124f7-e68d-400a-823f-f9eb506856a7\",\"PassengerName\":\"吉吉\",\"TicketNumber\":\"\"}}"
}

result=
{
"0130513113839835855":{"PassengerID":"3f4124f7-e68d-400a-823f-f9eb506856a7","PassengerName":"吉吉","TicketNumber":""}
}


result结果又是一个序列而已
------解决方案--------------------
用你的数据写了一个demo
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Dynamic;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = @"
{
  ""code"": 200,
  ""status"": ""OK"",
  ""result"": ""{\""0130513113839835855\"":{\""PassengerID\"":\""3f4124f7-e68d-400a-823f-f9eb506856a7\"",\""PassengerName\"":\""吉吉\"",\""TicketNumber\"":\""\""}}""
}";
            dynamic a = JsonConvert.DeserializeObject<ExpandoObject>(s);
            dynamic b = JsonConvert.DeserializeObject<ExpandoObject>(a.result);
            var d = (IDictionary<string, object>)b;
            Console.WriteLine("a.status={0}", a.status);