XML – JSON converter

      No Comments on XML – JSON converter

Starting with release 4.0 of XML ValidatorBuddy the editor also offers an XML to JSON converter. You can do conversions from XML to JSON and also from JSON to XML with a single click. To convert multiple XML files use the built-in File Explorer window and select the documents you want to convert. Afterwards start the conversion with the “Convert XML to JSON” command from the XML menu:

Convert XML to JSON

Converting the current document

Simply use the “Convert XML to JSON” and “Convert JSON to XML” commands with the currently active document from the editor as input. A new document will be created and contains the XML or JSON output of the conversion afterwards. Use the Save command if you want to keep the result. Assign a JSON schema on the “Quick Associations” window if you want to run the JSON validator.

Set additional conversion options

The editor provides several options to enhance and control the XML to JSON conversion process. XML ValidatorBuddy can also apply a stylesheet to the XML before the XML is converted. This way you can transform the input or take only the XML nodes you are interested in:

XML to JSON options dialog

Options dialog for XML to JSON conversion.

It is also possible to add prefixes to all attribute names coming from the XML. This allows to distinguish between element nodes and attributes also in the JSON output.

In order to keep all namespace prefixes in JSON please check the “Keep namespace prefix” option. Otherwise all prefixes will be removed from the output.

Converting from the built-in File Explorer window

XML ValidatorBuddy will convert all files selected in the File Explorer window from XML to JSON. Regardless of the file extension the conversion process assumes that all selected files are XML documents and XML ValidatorBuddy tries to convert them to the JSON file format. After a document has been converted, the editor also applies a JSON well-formed check to make sure that the generated output is readable JSON. You can apply the JSON well-formed check separately on one or many files by using the “Check if JSON well-formed” command from the JSON menu.

The converted JSON document gets the same file title and has only the file extension replaced with .json. If there is already a file present with this name, the conversion is not executed and no document is written.

Use the “Convert JSON to XML” command from the JSON menu to convert any number of JSON documents to XML. The process is basically the same as the one from the XML to JSON conversion.

»crosslinked«

Leave a Reply