With NJsonSchema.CodeGeneration you can't send the actual JSON in directly either, you first need to convert it to an actual schema (You will often get the error: Unable to cast object of type 'System.String' to type 'NJsonSchema.JsonSchema4 otherwise).Įxample with running code, Schemas folder located at project root: class Program Manatee.Json supports draft 4, draft 6, draft 7 (MIT) In order to answer this correctly you need to know what version (draft) the Json Schema has.Įxamples which libraries can handle which Schema (): Json.NET Schema supports draft 3, draft 4, draft 6 (MIT)
So if anyone knows a tools or has an idea on how I could generate those classes (I tried a tool that create the classes in Java but I couldn't make it work). There is JSON.NET but it seems to be a library and not a tool and I didn't found any information about generating classes with it. I found a lot of tools to validate a JSON string against a JSON Schema or to generate classes from the JSON string but nothing that seem to help me. Then it would be easy to create the classes as there are plenty of tool to generate classes from XSD. To convert a JSON Schema to an XSD file.To generate C# classes from a JSON Schema.So I'm looking for a tool that would allow me either : In order to facilitate the development I'd like to generate the corresponding classes in C# but as the files contain quite a lot of information and there are a dozen of files, I don't really want to create those classes manually. My problem is that the communication specifications only contain JSON Schema files (based on ). net framework, my Web Service is returning a C# object containing all the information that are then serialized by the framework using DataContracts. The client is an iPad application that is currently being developped by another team, So I'm working on specifications, without example data.Ĭurrently the JSON string is created by the. I'm creating a C# WCF Web Service that return a lot of data in a JSON format.