Altova XMLSpy 2025 Enterprise Edition

Convert JSON to/from YAML

Home Prev Top Next

Make the JSON or YAML file you want to convert to the other format the active file and select the Convert JSON to/from YAML command. The command also works for converting a JSON schema between the two formats it can be written in: JSON and YAML.

 

If you convert a JSON document to YAML, the conversion is carried out immediately, without any user interaction.

If you convert a YAML document to JSON, a dialog appears(screenshot below) in which you must choose the JSON document type you want.

ConvertYAML2JSON

If you choose Auto, the most suitable type is automatically detected. For example, if the YAML document has comments and you choose Auto, then the output will likely be a JSON Comments document. If, on the other hand, you were to choose JSON for the same YAML document with comments, then a JSON document would be created—but without comments. Similarly, other types of data that have no corresponding representation in the target JSON format will be either converted to an appropriate near type or will be ignored. So you should choose a suitable target format. If you are not sure, then choose Auto.

 

The active file will be converted into the document of the other format and will be opened in a new window. You can save the document to file from this window.

 

Note:This command is also available in the context menu of XMLSpy project folders and files. When used on a project folder, the command allows you to batch convert all the JSON files or all the YAML files in the folder.

 

© 2018-2024 Altova GmbH