Command-line conversion

Convert XML and JSON from the command-line with JSONBuddy

Use one settings file to convert a folder of JSON or XML documents, include subfolders, control output and overwriting, and preserve a conversion log.

JSONBuddy command-line output in a Windows terminal
The Windows command-line tool runs reusable settings files for validation, formatting, and conversion tasks.
  • Text + gridChoose the clearest view
  • Precise diagnosticsUnderstand each result
  • CLI + CIAutomate repeatable checks

Repeatable folder conversion

Configure once, then run the conversion again

valbuddy.exe reads an XML settings file that identifies the conversion direction, source folder, included file extensions, subfolder behavior, output folder, overwrite choice, and log destination.

1

Choose the source and output folders

Use absolute Windows paths and keep the source unchanged until the generated files have been inspected.

2

Set the conversion type

Use json2xml for JSON input or xml2json for XML input.

3

Run and review the log

Pass the settings file to valbuddy.exe, then inspect the generated files and conversion log.

JSON to XML

Convert JSON files in a folder

The example includes .json files in the source folder and its subfolders, writes XML to a separate folder, and allows existing output files to be replaced.

myJSON2XMLconfig.xml
<batch_settings>
            <batch_units>
            <log_document path="D:\Documents\convert_json_log.xml"/>
            <batch_unit output_folder="D:\Documents\XML-converted"
            overwrite="true" type="json2xml">
            <folder_settings folder="D:\Documents\JSON" subfolders="true"/>
            <file_extensions><extension>json</extension></file_extensions>
            </batch_unit>
            </batch_units>
            </batch_settings>

valbuddy.exe myJSON2XMLconfig.xml

XML to JSON

Control XML mapping options

Set type="xml2json" and use conversion parameters where the JSON representation needs attribute prefixes, namespace handling, string typing, whitespace preservation, or an XSLT preprocessing step.

  • add-attribute-prefix
  • strip-namespace and colon-replace
  • transform-xsl
  • force-string-type and force-attributes-string-type
  • preserve-whitespace
Protect source data

Begin with a representative copy, write results to a separate folder, and inspect attributes, namespaces, arrays, repeated elements, encodings, and the log before processing the complete data set.

Platform availability

Choose where to run this workflow

  • CLI / CIRun settings-based conversion with valbuddy.exe on Windows.