且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用JObject,JToken和JArray进行JSON.NET解析

更新时间:2023-01-18 08:31:35

您的JSON无效.您可以通过 JSONLint.com 对其进行检查.您在jsonTEMPLATE属性的值两边加上了引号,如果将其解释为对象,则不应该使用引号:

Your JSON is invalid. You can run it through JSONLint.com to check it. You have quotes around the value of the jsonTEMPLATE property, which should not be there if it is to interpretted as an object:

{
    "Name": "Service",
    "jsonTEMPLATE": "{"komponent": [{"name": "aa"}, {"name": "bb"}]}"
}

要使代码成功,JSON需要看起来像这样:

The JSON needs to look like this for your code to succeed:

{
    "Name": "Service",
    "jsonTEMPLATE": {"komponent": [{"name": "aa"}, {"name": "bb"}]}
}