c# - 将嵌套的 json 字符串解析为字符串列表

标签 c# json list

我有以下 json

["a", ["amazon", "amazon.in", "aaj tak", "axis bank", "amar ujala", "amazon.com", "aadhar card", "airtel online recharge", "airtel", "axis bank internet banking", "amazon india", "air india"]]

现在我想在列表字符串中获取它

我试过了

var obj = Newtonsoft.Json.Linq.JObject.Parse(result);


Newtonsoft.Json.Linq.JObject obje = Newtonsoft.Json.Linq.JObject.Parse(result);

还有许多其他选项,但没有任何效果,它会抛出错误。

附加信息:

Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1.

最佳答案

您有一个 JSON 数组,而尝试将其解析为 JSON 对象

替换

var obj = Newtonsoft.Json.Linq.JObject.Parse(result);

var obj = Newtonsoft.Json.Linq.JArray.Parse(result);

关于c# - 将嵌套的 json 字符串解析为字符串列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33796129/

相关文章:

c# - 将对象传递给 jint 中的函数并返回值

c# - 如何获取 .NET 控件的 HTML 代码

c# - 如何以最简单的方式在其他手机上安装Windows Phone 8.1应用程序?

java - Retrofit2 安卓 : Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $

Java变量对象搜索列表

python - 从具有特定索引的python列表中挑选项目

c# - 与 SslStream 的 XMPP TLS 连接

json - 如何反序列化并转换为 Long 所有数字?

c# - 为什么即使在转换其父类之后,Web API Action 方法也会返回子属性的 Json

python - 这个 python 列表删除循环有什么问题?