How to instance validation using json-schema-validator

473 views
Skip to first unread message

sha p

unread,
Mar 11, 2015, 2:36:25 AM3/11/15
to json-schem...@googlegroups.com

Hi,
 I have come across while reading this docs , "instance validation" and "schema validation".
What exact "instance validation" means and what for it is useful ?
How to do it ? any samples around it ? or any doc around it ?


Thank you.
~Shyam

Christopher Fenner

unread,
May 11, 2015, 10:14:07 AM5/11/15
to json-schem...@googlegroups.com
Hi, you can validate an instance with a schema. 

Like this: 

JsonNode instance = new JsonNodeReader().fromReader(new FileReader(<myJsonFileILikeToValidate>));
JsonNode schema = new JsonNodeReader().fromReader(new FileReader(<myJsonSchemaFile>));

ProcessingReport report = JsonSchemaFactory.byDefault().getValidator().validateUnchecked(schema, instance );

regards chris
Reply all
Reply to author
Forward
0 new messages