如何使用C#/JSON.NET创建JSON文件? [英] How to create JSON file using C#/JSON.NET?

查看:768
本文介绍了如何使用C#/JSON.NET创建JSON文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在JSON.Net(Newtonsoft)中使用JSONTextWriter或SerializeObject方法创建JSON文件(1-3MB)的最佳方法是什么?

请给我用于在JSON文件下面创建的示例C#代码;

{
    "$ schema":"http://schema.aa.com/schemas/2015-05-01/mySchema1.json#",
    "contentVersion":"1.0.0.0",

    引擎":{
        " cc" ;:" 2500" ;,
        类型":拳击手"
       }

   参数":{
       "名称" ;: {
           "type":"String"
       },
       " Id" ;: {
           "type":"String"
       }

     }

}

谢谢

Satheesh

解决方案

http://www.newtonsoft.com/json/help/html/M_Newtonsoft_Json_Linq_JObject_Parse.htm


Hi All,

What is best way to create JSON file(1-3MB) using JSONTextWriter or SerializeObject method in JSON.Net(Newtonsoft)?

Please give me the sample C# code for creating below JSON file;

{
    "$schema": "http://schema.aa.com/schemas/2015-05-01/mySchema1.json#",
    "contentVersion": "1.0.0.0",

     "Engine": {
        "cc": "2500",
        "type": "boxer"
        },

    "parameters": {
        "Name": {
            "type": "String"
        },
        "Id": {
            "type": "String"
        }

      }

}

Thanks,

Satheesh

解决方案

http://www.newtonsoft.com/json/help/html/M_Newtonsoft_Json_Linq_JObject_Parse.htm


这篇关于如何使用C#/JSON.NET创建JSON文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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