In order to answer this correctly you need to know what version (draft) the Json Schema has.
Examples which libraries can handle which Schema (2018-01-19):
Json.NET Schema supports draft 3, draft 4, draft 6 (MIT)
Manatee.Json supports draft 4, draft 6, draft 7 (MIT)
NJsonSchema supports draft 4 (Ms-PL)
http://json-schema.org/implementations.html#validator-dotnet
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).
Example with running code, Schemas
folder located at project root:
class Program
{
static void Main(string[] args)
{
var location = Assembly.GetExecutingAssembly().Location;
var path = Path.GetFullPath(Path.Combine(location, @"..\..\..\Schemas"));
var schemaJson = File.ReadAllText($"{path}Test.json");
var schema = JsonSchema4.FromJsonAsync(schemaJson).Result;
var generator = new CSharpGenerator(schema);
var generatedFile = generator.GenerateFile();
}
}