简体   繁体   English

将多个JSON字符串转换为C#中的数据集

[英]Convert multiple json strings to dataset in c#

Below is my json string and I wanted it to convert to readable format in c# so that i can convert to dataset. 以下是我的json字符串,我希望将其转换为c#格式的可读格式,以便可以转换为数据集。 Please advise. 请指教。

ITCFScenario12 ITCFS场景12

{
    ""TC"":{
        ""test_case"":""ITCFScenario12"",
        ""data_type"":""testcomplete"",
    }
    ""3"":{
    ""scenariodescription"":""Create Client"",
    },
    ""7"":{
    ""scenariodescription"":""CreateServicePlan"",
    },
},

ITCFScenario13 ITCFS场景13

{
    ""TC"":{
        ""test_case"":""ITCFScenario12"",
        ""data_type"":""testcomplete"",
    }
    ""3"":{
    ""scenariodescription"":""Create Client"",
    },
    ""7"":{
    ""scenariodescription"":""CreateServicePlan"",
    },
},

Your JSON object is not in valid format. 您的JSON对象格式无效。 It should look like below, 如下图所示

{
    "TC":{
        "test_case":"ITCFScenario12",
        "data_type":"testcomplete"

    },
    "3":{
    "scenariodescription":"Create Client"
    },
    "7":{
    "scenariodescription":"CreateServicePlan"
    }
}

Use any online tools to validate the JSON object. 使用任何在线工具来验证JSON对象。 TO check it's in correct format or not. 要检查其格式是否正确。 https://jsonformatter.org/ So if you are getting it from front end, it's need to be corrected. https://jsonformatter.org/因此,如果要从前端获取它,则需要对其进行更正。

Once its in correct format Newtonsoft JSON framework can use for all other operations. 一旦采用正确格式,Newtonsoft JSON框架便可以用于所有其他操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM