如何反序列化仅包含值的JSON数组? [英] How do I deserialize a JSON array that contains only values?

查看:117
本文介绍了如何反序列化仅包含值的JSON数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从网络功能中得到了这个结果.

I'm getting this result from a web function.

["767,20150221122715,121053103,14573465,1,7,302",
"767,20150221122756,121053165,14573375,1,0,302",
"767,20150221122840,121053498,14572841,1,12,124"]

通常Json具有PropertyName:值 但这有一个字符串数组,每个字符串都有用逗号分隔的值.我知道每个值位置的含义.

Usually Json have PropertyName: Value But this have an array of strings, and each string have the values separated by comma. I know what each value position mean.

我尝试使用JsonConvert.DeserializeObject,但无法正常工作.

I try using JsonConvert.DeserializeObject but couldn't make it work.

string deserializedProduct = JsonConvert.DeserializeObject<string>(json);
//and
List<string> deserializedProduct = JsonConvert.DeserializeObject<string>(json);

我可以解析字符串进行拆分,但是我想知道是否有一种简单的方法.

I can parse the string doing a split, but I'm wondering if there is an easy way.

推荐答案

根据 http://来回答您的问题json.org/,它是有效的JSON值(字符串数组).

To answer your question, according to to http://json.org/, it is a valid JSON value (an array of string).

要根据此堆栈溢出问题将其反序列化使用 JsonConvert.DeserializeObject<List<string>>(json); 进行转换

To deserialize it according to this stack overflow question you should use JsonConvert.DeserializeObject<List<string>>(json); to convert it

这篇关于如何反序列化仅包含值的JSON数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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