While XMLSpy might not be the first tool developers think of when they’ve got a JSON development task, XMLSpy includes comprehensive support for working with JSON, JSON Schema, and related technologies.
Over the past few product releases, we’ve added intelligent functionality for editing and converting JSON and JSON5 data to the product. We’ve completed the circle with one-click conversion between XML Schemas and JSON Schemas, as well as sample instance generation and JSON Schema documentation generation. And, most recently, we’ve added support for processing JSON with XSLT, XPath, and XQuery.
Let’s walk through some common examples demonstrating this functionality – and see how these time-saving tools make XMLSpy the only JSON development tool you’ll need.
JSON Editor and JSON Schema Editor
For editing JSON and JSON5 documents, the JSON editor in XMLSpy offers both the intelligent text view and graphical grid view, with intelligent entry helpers and menus to help you make valid choices.
The JSON Schema editor includes the graphical schema editor shown below. Structured as a set of nested containers JSON Schema simply lends itself to a graphical view. Approaching a schema visually allows for rapid development and visualization of structure.
Unlike other JSON editing tools, XMLSpy supports both JSON and XML (and converts between the two), giving you an easy way to work with JSON in the same environment where you’re developing XML, AJAX, and Web services applications – the best of both worlds.
Convert XSD <-> JSON Schema
Developers are increasingly turning to JSON Schema to apply the benefits of data validation to JSON data exchanges. However, this requires significant time and effort to be allocated to schema development – a bit of a contradiction compared to JSON’s promised simplicity.
Luckily, there’s no reason to re-invent the wheel. Given the large volumes of existing XML Schemas, the ability to convert from XSD to JSON Schema quickly and easily can allow developers to focus on implementation rather than building schemas from scratch, and XMLSpy supports this with one-click. It’s just as easy to convert from JSON Schema to XSD, for complete flexibility.
Let’s take a look at a fairly common transaction scenario – the purchase order. There are many existing XML Schemas for this use case, of course, including one that ships in the Examples directory of XMLSpy. Here’s the schema shown in the graphical XML Schema editor:
Using the Convert XML Schema to/from JSON Schema option in the Convert menu, I can specify conversion options…
…and click OK to generate the JSON Schema, shown here in the graphical JSON Schema editor:
And here’s a snippet of the corresponding JSON Schema code in Text View:
From here, you can edit the schema further in graphical or text view, or go on to generate a sample JSON instance.
This XML Schema/JSON Schema conversion functionality adds to existing support for converting between XML instance files and JSON instance files.
Generate Sample JSON Instances
Once you’ve got your JSON Schema, it’s useful to generate a sample instance based on it to give you a jumpstart on any additional editing.
The Generate Sample JSON File dialog in XMLSpy allows you to specify whether to generate non-mandatory object properties, the length of arrays, and repetitions of recursive definitions. You can also specify whether or not the active JSON Schema should be automatically assigned to the generated JSON sample file. Click OK, and you’ll immediately have a valid JSON instance to use as a starting point.
Here is a snippet of the sample generated from the JSON Schema above:
Generate JSON Schema Documentation
Documentation is an important part of schema development, allowing concise communication with other developers and providing clarity as a schema evolves. XMLSpy offers automatic JSON Schema documentation generation – a huge time saver – with numerous options that allow you to customize your documentation, and then output it in print and/or web formats.
Here’s a snippet of the documentation generated in HTML for the JSON Schema shown above:
Processing JSON with XSLT and XQuery
XMLSpy provides tons of support for all things XSLT, XPath, and XQuery – and, luckily enough, the most recent versions of these these standardized languages also provide an elegant means for querying and transforming JSON by targeting JSON maps, arrays, and objects.
- Querying JSON documents with XPath 3.1 or XQuery 3.1 in the XPath/XQuery window
- Transforming JSON documents with an XSLT 3.0 or XQuery 3.1 file
See how it works:
Comprehensive JSON Development
The features described above round out JSON and JSON Schema functionality in XMLSpy, which now includes:
- Support for JSON and JSON5
- Intelligent JSON editor with text and grid views
- Graphical JSON Schema editor
- Validation based on JSON Schema
- XML instance <-> JSON instance conversion (one or many files)
- XSD <-> JSON Schema conversion
- Sample JSON instance generation
- JSON Schema documentation
- Transforming JSON with XSLT
- Querying JSON with XPath and XQuery
JSON Support Across the Product Line
Altova offers a full line of JSON tools, for editing to high-volume validation to data integration.
If JSON data mapping and integration, such as generating JSON from or writing JSON to a relational database, is a requirement, you can find support in MapForce, Altova’s powerful any-to-any data mapping tool.
Download a Free Trial
You can try any of these JSON tools free for 30-days.