JSON, JSON Schema
As part of its IDE functionality, XMLSpy provides support for the editing and validation of JSON data documents (instance documents) and for the creation of syntactically and semantically correct JSON Schema documents.
XMLSpy also provides support for Avro and Avro Schema.
All XMLSpy functionality that is available for JSON instance documents is also available for JSON5 instance documents. However, note the following major differences between JSON5 and JSON, and in the way XMLSpy handles the two formats:
•JSON5 is not an official successor to JSON. It therefore uses its own file extension: json5.
•By default, XMLSpy recognizes files with the .json file extension as JSON instance documents, and those with the .json5 file extension as JSON5 instance documents.
•JSON5 instance documents can be validated against JSON schemas. JSON instance documents, which can be representations of Avro instances, can be validated against both JSON schemas and Avro schemas. See the section Validating JSON Documents for more on this topic.
In this documentation, the term JSON instances refers to both JSON and JSON5 instance documents unless otherwise indicated. Also see the section Differences between JSON5 and JSON.
JSON and JSON Schema in XMLSpy
Both document types—JSON instance and JSON schema—are written in JSON format, and must adhere to JSON rules of well-formedness and validity. Both types of document (instance and schema) typically have the .json file extension. JSON instances can be edited in Text View and Grid View, and JSON schema documents can be edited in those two views as well as in JSON Schema View, which is a graphical schema editor.
XMLSpy provides the following support for working with JSON instance and JSON schema documents:
•In Text View, syntax coloring and syntax checks; auto-completion in JSON schemas and in instance documents if these have schema associations, folding margins; and structural markings. All of these features ease and speed up the editing of valid JSON instance and JSON schema documents. Text View provides validation of both instance and schema documents.
•In Grid View, a tabular grid structure that helps to better visualize document structure. You can edit directly in Grid View. You can also switch between Text View and Grid View to suit your editing needs. Grid View provides validation of both instance and schema documents.
•JSON Schema View displays JSON schemas in a graphical layout. This enables the use of drag-and-drop functionality (in addition to text entry) for the quick creation of JSON schemas. Entry helpers within the view provide editing input. Additionally, the schema is continuously checked for validity, and errors are flagged.
JSON instances: opening existing instance documents and creating new instance documents
•In the Options | File types section, you can set the default view (Text View or Grid View) for opening JSON/JSON5 instance documents. Existing JSON/JSON5 documents will be opened in the default starting view you select. You can switch between Text View and Grid View at any time.
JSON schemas: opening existing schemas and creating new schemas
•To create a new JSON schema document, click File | New, and select json: JSON Schema. The new JSON schema document will be opened in JSON Schema View, with the \$schema keyword at the start of the document. You can switch to Text View or Grid View at any time.
In this section
This section is organized into the following topics:
•JSON Data explains the basics of JSON documents
•JSON Schema describes what a JSON schema is and how it works
•JSON Lines and JSON Comments provides information about two additional JSON specifications supported by XMLSpy
•JSON Documents in Text View shows you how to work with the JSON-relevant features of Text View
•JSON Documents in Grid View describes how to edit JSON documents in Grid View
•JSON Schema View explains the JSON-schema-editing features of the view and how you can use it when creating your JSON projects
•Validating JSON Data/Documents describes how to assign a JSON schema to a JSON document and how to validate JSON documents
•Inserting JSON Fragments describes how to quickly insert JSON text fragments into your JSON document from external sources
•JSON Transformations with XSLT/XQuery describes how JSON documents can be queried with XPath/XQuery 3.1
•XQuery Expressions for JSON gives a broad introduction about using XQuery with JSON documents
•Generating JSON Schema from a JSON Instance describes the functionality to generate a schema from an instance
•Generating a JSON Instance from a JSON Schema describes how to generate an instance from a schema
•Converting between JSON and XML describes how to convert between JSON and XML in XMLSpy