简体   繁体   中英

How to load JSON Class Schema with Visual Studio

I used to use a converter to convert JSON Schema to C# code and then copy & paste the C# code to my Visual Studio project. Now I wonder if I can just copy & paste the JSON schema to my Visual Studio project directly so that the schema will be parsed automatically and the classes from the schema are ready to use (so I don't have to do it manually, and keep the JSON schema itself as the single source of truth).

Note: This is not about parsing JSON, please refer to JSON Schema http://json-schema.org/

No unfortunatelly there is not such an option, however you can use JSON.NET that already 100 Million+ are using it. you can Serialize and deserialize with a single line of code and its available via nuget with a click.

https://www.nuget.org/packages/newtonsoft.json/

You can use Newton Soft JSON to serialize and deserialize json. Few examples are

Get Object Value from JSON Object in C#

Json path query in JObject.SelectTokens in Json.net not returning results

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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