As JSON’s popularity for web app development increases, the range of tools supporting the environment expands into XML territory. The key is to maintain the simplicity and other strengths of JSON while broadening the environment’s appeal for web developers.
JSON or XML? As with most programming choices, determining which approach to adopt for your web app’s server calls is not a simple “either-or” proposition.
JSON, or JavaScript Object Notation, was conceived as a simple, concise data format for encoding data structures in an efficient text format. In particular, JSON is less “verbose” than XML, according to InCadence Strategic Solutions VP Michael C. Daconta in an April 16, 2014, article on GCN.com.
Despite JSON’s efficiency, Daconta lists four scenarios in which XML is still preferred over JSON:
SOAP APIs and REST APIs are also not strictly either/or
One of JSON’s claims to fame is that it is so simple to use it doesn’t require a formal specification. George Anadiotis explains in a January 28, 2014, post on the Linked Data Orchestration site that many real-world REST-based JSON apps require schemas, albeit much different schemas than their SOAP-based XML counterparts.
The most obvious difference is that there are far fewer JSON tools than there are XML tools. This is understandable considering that XML has been around for decades and JSON is a relative newcomer. However, JSON tools are able to reverse-engineer schemas based on the JSON fragments you arrange on a template. The tools’ output is then edited manually to complete the schema.
Anadiotis presents a five-step development plan for a JSON schema:
Tool converts JSON to CSV for easy editing
JSON may trail XML in quantity and quality of available toolkits, but the developer community is working hard to close the gap. An example is the free JSON-to-CSV converter developed by Eric Mills of the Sunlight Foundation. The converter lets you paste JSON code into a box and then automatically reformat and recolor it in an easy-to-read table.
Mills’ goal in creating the converter was to make JSON “as approachable as a spreadsheet,” as Janet Wagner repots in a March 31, 2014, post on the Programmable Web site. While the converter is intended primarily as a teaching tool that demonstrates the potential of JSON as a driver of the modern web, Mills plans to continue supporting the converter if is used widely.
Conversely, if you’d like to convert Excel/CSV data to HTML, JSON, XML, and other web formats, take the free Mr. Data Converter tool out for a spin.