BART Legacy API Output Formats

The BART Legacy API was originally developed to provide XML output for all commands. BART added an option to provide results in JSON format several years later.

XML Format

The default format for API output is still XML. It is standard XML output with UTF-8 encoding. In order to facilitate conversion to JSON, any XML elements that have attributes DO NOT also have values. Most XML to JSON conversions can't interpret data if there is both an attribute and a value (e.g. <item id="1">orange</item>, the attribute "id" and the value of "orange" cause issues for most automated JSON conversion tools if used together.)

JSON Format

In order to provide the JSON output, BART converts the standard XML output into JSON. Wherever there are items that may have one or more values, we force the JSON output to use arrays so that the JSON formatting is consistent no matter how many items there are. This should making parsing the JSON easier and consistent.

The JSON output format can be specifed for any call by adding "&json=y" to any API call.