json schema

JSchema schema = JSchema.Parse(@"{
  'type': 'array',
  'item': {'type':'string'}
}");
JsonTextReader reader = new JsonTextReader(new StringReader(@"[
  'Developer',
  'Administrator'
]"));

JSchemaValidatingReader validatingReader = new JSchemaValidatingReader(reader);
validatingReader.Schema = schema;

JsonSerializer serializer = new JsonSerializer();
List<string> roles = serializer.Deserialize<List<string>>(validatingReader);

0
7
A-312 69370 points

                                    String json = &quot;{\&quot;sectors\&quot;: [{\&quot;times\&quot;:[{\&quot;intensity\&quot;:30,&quot; +
                &quot;\&quot;start\&quot;:{\&quot;hour\&quot;:8,\&quot;minute\&quot;:30},\&quot;end\&quot;:{\&quot;hour\&quot;:17,\&quot;minute\&quot;:0}},&quot; +
                &quot;{\&quot;intensity\&quot;:10,\&quot;start\&quot;:{\&quot;hour\&quot;:17,\&quot;minute\&quot;:5},\&quot;end\&quot;:{\&quot;hour\&quot;:23,\&quot;minute\&quot;:55}}],&quot; +
                &quot;\&quot;id\&quot;:\&quot;dbea21eb-57b5-44c9-a953-f61816fd5876\&quot;}]}&quot;;
        String result = JsonSchemaGenerator.outputAsString(&quot;Schedule&quot;, &quot;this is a test&quot;, json);
            /* sample output
            {
              &quot;title&quot;: &quot;Schedule&quot;,
              &quot;description&quot;: &quot;this is a test&quot;,
              &quot;type&quot;: &quot;object&quot;,
              &quot;properties&quot;: {
                &quot;sectors&quot;: {
                  &quot;type&quot;: &quot;array&quot;,
                  &quot;items&quot;: {
                    &quot;properties&quot;: {
                      &quot;times&quot;: {
                        &quot;type&quot;: &quot;array&quot;,
                        &quot;items&quot;: {
                          &quot;properties&quot;: {
                            &quot;intensity&quot;: {
                              &quot;type&quot;: &quot;number&quot;
                            },
                            &quot;start&quot;: {
                              &quot;type&quot;: &quot;object&quot;,
                              &quot;properties&quot;: {
                                &quot;hour&quot;: {
                                  &quot;type&quot;: &quot;number&quot;
                                },
                                &quot;minute&quot;: {
                                  &quot;type&quot;: &quot;number&quot;
                                }
                              }
                            },
                            &quot;end&quot;: {
                              &quot;type&quot;: &quot;object&quot;,
                              &quot;properties&quot;: {
                                &quot;hour&quot;: {
                                  &quot;type&quot;: &quot;number&quot;
                                },
                                &quot;minute&quot;: {
                                  &quot;type&quot;: &quot;number&quot;
                                }
                              }
                            }
                          }
                        }
                      },
                      &quot;id&quot;: {
                        &quot;type&quot;: &quot;string&quot;
                      }
                    }
                  }
                }
              } 
            }
             */

        // To generate JSON schema into a file
        JsonSchemaGenerator.outputAsFile(&quot;Schedule&quot;, &quot;this is a test&quot;, json, &quot;output-schema.json&quot;);

        // To generate POJO(s)
        JsonSchemaGenerator.outputAsPOJO(&quot;Schedule&quot;, &quot;this is a test&quot;, json, &quot;com.example&quot;, &quot;generated-sources&quot;);
    }

0
0
4.1
10
Krish 100200 points

                                    {
    &quot;type&quot;: &quot;array&quot;,
    &quot;items&quot;: {
        &quot;type&quot;: &quot;string&quot;,
        &quot;enum&quot;: [&quot;one&quot;, &quot;two&quot;, &quot;three&quot;]
    }
}

4.1 (10 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
json schema type on description json schema objects json schema example use JSON schema enumerated type parts of json schema custom json schema generator c# json with schema what is a JSON schema written in schema data json $schema jsonschema latest hson schema generator generate json-schema create json schema online json-schema builder json schema value json schema generator from c# online json schema &quot;#&quot; basic json schema creator schema json tool why need json schema C# JSON Schema generator model json schema genertae json schema table generator json schema type json schema syntax JSON Schema&para; define json schema json schema define object json latest schema Generate Schema.json string json schema strings json schema what does schema mean in json json.schemas schema generate from json json schema written in when to use # in json schema why to use # in json schema json schema generator with default json ld schema generator json Schema object schema schema json example how to create a schema from a JSON object json schema in json schema json type get json schema get json schema of a json get json schema of json Infyom Json Schema Generator json schema to schema standard json schema JSON Schemas json schema options json schema full example online json schema maker JSON Schema structure generate json for the schema online understanding json schema example of json schema json schema generator in C# what is json schema store json schema for more information json schema for information how to view json schema how to make json schema how do you represent a json schema json schema types json schema spec online json schema creator make json schema basic json schema schema.json() json schema object sample json schema with enumeration create JSON Schemas json vew schema how to make data schema for json schema.json how to use json schema json schema properties create json schema from json online which json schema to use json to schema builder JSON Schema-form generator understand json schema json generator from schema json schema pattern json schema tool online json schema specific object json schema example generator json schema string how to create json schema what is json schema json schema tool json schema form json schema maker json schema standard Schema graph generator design schema in json online visual studio json schema generator json schema ui generator json schema one of json schema creation online json data generator from schema json schema generate json schemaa generate json with schema online schema json what are schemas in json json and json schema create json schema from json joi create schema from json define json schema online JSON Schema sample jason schema json schema documentation generator opis json schema create schema from json online json lsd schema json schema define json to schema json schema tutorial generate json schemaf what is a json schema json schema examples json schema definitions json schema builder json schema or json schema example get schema from json get json schema from json JSON-LD Schema Generator json schema generator java json schema enum different types json schema generato json schema generator jquery json schema generatpr json schema json based schema generator online json schema create online json schema builder online Generate JSON Schemas json schema generator c# json generate schema online generate json from schema online schema json generator json generate schema json schema generator draft 4 online json schema tool json forms schema generator generate JSON document from a JSON Schema json to schema converter json object to schema generate schema from json json schema enum json schema faker examples schema generator json json schema generation generate sample data from json schema online onlinejson schema generator json to json schema online json schema to jninja2 online json schema creator generate json schema online json schema conversion json to diagram online json schema generator online json schema designer online generate json schema create js schema from JSON online online schema generator epjson schema auto create json schema from database json to json schema online json to json schema converter json schemat tool create json schema jsonschema editor generate schema for json object json from schema generator json from jsonschema draft json structure tool online json schema generator json generator convert json to schema generate json schema json get schema generate json schema from json data online jsonschema json schema from json generate json schema from json json creator schema convert schema to json how to create schema for json json schema generator
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source