Skip to content
Rico Suter edited this page May 14, 2016 · 11 revisions

Package: NJsonSchema.CodeGeneration

The CSharpGenerator class generates C# DTO classes from a given JSON Schema:

var schema = JsonSchema4.FromType<Person>();
var settings = new CSharpGeneratorSettings();
var generator = new CSharpGenerator(schema, settings);
var code = generator.GenerateFile();

Settings

  • Namespace: The namespace of the generated classes
  • RequiredPropertiesMustBeDefined (default: true)
  • DateTimeType (default: DateTime)
  • ArrayType (default: ObservableCollection)
  • DictionaryType (default: Dictionary)
  • ClassStyle: Inpc (default) | Poco

More information: CSharpGeneratorSettings.cs

Clone this wiki locally