Questions tagged [jsonschema]

A JSON Schema is a JSON document (an object) which defines constraints on what other JSON documents (the instances) should obey; it can also be used to interpret instances so as to provide links to external resources (hyper schema).

JSON (JavaScript Object Notation) Schema defines the media type application/schema+json, a JSON based format for defining the structure of JSON data.

JSON Schema provides a contract for what JSON data is required for a given application and how to interact with it. JSON Schema is intended to define validation, documentation, hyperlink navigation, and interaction control of JSON data.

References:

For the latest Internet Draft documents, see the specification section of the website.

3348 questions
1
vote
1 answer

JSON SChema to JSON Object

Can anyone help me to create the code to generate Sample JSON using JSON Schema in javascript. I have a JSON Schema as input and I have to get JSON as output after javascript transformation. The code should be dynamic. example: JSON SCHEMA-- { …
Gunjan
  • 21
  • 1
  • 2
1
vote
0 answers

How to best exchange JSON data with strict schema?

I am currently having an issue concerning best practices where I essentially am trying to figure out the best method for exchanging instantiation settings to an arbitrary function. At the moment, I use a setup function responsible for constructing…
1
vote
1 answer

Is the Python jsonschema validator using a superset of the actual jsonschema?

When using Python jsonschema it is possible to define schemas and instances that cannot be expressed in valid JSON. >>> import jsonschema >>> schema = { ... "type": "object", ... "properties": {"1": {}, 2:{}}, ... "additionalProperties":…
Stefano M
  • 4,267
  • 2
  • 27
  • 45
1
vote
3 answers

How should a json-schema (draft7) implementation resolve `$ref`s defined in unknown keywords?

JSON-Schema-Test-Suite defines schemas such as this, and I assume they are valid: { "tilda~field": {"type": "integer"}, "slash/field": {"type": "integer"}, "percent%field": {"type": "integer"}, "properties": { "tilda":…
aravindanve
  • 979
  • 7
  • 14
1
vote
1 answer

Rapidjson giving validation success even when required field is missing

I was expecting rapidjson to give a validation error as my json file doesn't include one of the 'required' field mentioned in the schema. However, due to some reasons this doesn't happen. dbconf.json(json file) { …
Vishal Sharma
  • 1,670
  • 20
  • 55
1
vote
1 answer

json schema to ensure a string does not match any element of an array

{ "title":"x", "type:"string", "doesNotMatch":["element1","element2"] } Is there JSON schema which ensures that the JSON data will not match element1 and element2. {"x":element1} is invalid {"x":"daf"} valid provided "daf" is not equal to…
Punit Kulal
  • 79
  • 1
  • 8
1
vote
1 answer

JSON schema connecting arrays with properties

I've been asked to create JSON Schema with filetype called "zfs" containing array property pools, where each item of such array must have properties: name (string), volumes (array of strings), sizeInGB (number from 0 to 65536), and numberOfFiles…
1
vote
1 answer

Json schema field order

I know that fields listed in a json schema object have no defined order, since they are not an array, but I am looking for a way to be able to display them in the proper order in my application UI. Workarounds I have found so far include things…
Airborne Eagle
  • 373
  • 5
  • 11
1
vote
1 answer

Jackson JsonSchema - Object as string in schema

I'm using ComparableQuantity from JSR 385 reference implementation - this is not a case, just want to mention that subtype is generic and I cannot modify it. The case is that I am generating a Json schema with Jackson JsonSchemaModule. Currently,…
Witold Kupś
  • 524
  • 7
  • 14
1
vote
0 answers

Generate c# class structure from JSON Schema - online generator

Looking for a quick and dirty tool to generate a C# class structure for a given JSON Schema. Something like this http://json2csharp.rohitl.com/ (I don't like the output of this) I also found https://app.quicktype.io/. Are there others?
Greg Bala
  • 3,563
  • 7
  • 33
  • 43
1
vote
2 answers

Convert a JSON object A to JSON B object where B is a strict subset of A. Both governed by two json schemas. In .net core

I got a bunch of conversions to make where I am converting a JSON data structure from a superset to a subset. EX: A : { Name { first: bob middle: john last : bobster } } B : { Name { first: bob last : bobster …
Greg Bala
  • 3,563
  • 7
  • 33
  • 43
1
vote
1 answer

How to include Jsonschema multiple type parameter with enum?

By the below example question will get more clear: data = {"type": "object", "properties": {"product": {"type": ["boolean","string"]}}} It includes both boolean and string types. It works, but I want to limit the string part to a list of…
Alireza
  • 6,497
  • 13
  • 59
  • 132
1
vote
1 answer

jsonschema with custom property

I want to define a JsonSchema with a customProperty in it, this property follows some rules, so in order to validate those, I need to define a JsonSchema that will validate it. So far I've managed to describe it properly, but it only works for the…
1
vote
1 answer

jsonschema validation with conditional format

I have a schema that I want to add a "format" keyword to, but only on certain cases. I am having jsconschema draft 07 and I'm trying to use if/else statements, however, I think I'm starting to realize that you can't add formatting when using if/else…
rAFTA
  • 35
  • 5
1
vote
1 answer

How does the base URL change plain name fragment resolution with JSON Schema?

An excerpt from http://json-schema.org/draft-07/json-schema-core.html#rfc.section.8.2.4 { "$id": "http://example.com/root.json", "definitions": { "A": { "$id": "#foo" }, "B": { "$id": "other.json", …
Matt Wlazlo
  • 157
  • 2
  • 7
1 2 3
99
100