反序列化不带名称的JSON值 [英] Deserialize JSON value without name

查看:150
本文介绍了反序列化不带名称的JSON值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C#中反序列化仅包含值而没有名称的字符串.看起来像这样:问题是此字符串流没有名称,并且使用数组.

How can I deserialize a string in C# that only have values and no name. It looks like this: The problem is that this stream of string does not have name and uses array.

{
  "result": {
    "14400": [
      [
        1502985600,
        262.18,
        262.18,
        257,
        257,
        1096.0131
      ],
      [
        1503000000,
        257,
        261.33,
        254.8,
        257,
        1130.5897
      ]
   ],
 "14405": [
      [
        1503014400,
        258.03,
        261.5,
        257.01,
        257.01,
        520.7805
      ],
      [
        1503028800,
        258,
        260.98,
        252.4,
        259.56,
        298.5658
      ],
   ]
  ]
 }
}

推荐答案

只需创建一个类似

public class Root
{
    public Dictionary<int,List<List<double>>> Result { get; set; }
}

并反序列化为

var res = JsonConvert.DeserializeObject<Root>(json);

这篇关于反序列化不带名称的JSON值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆