The XML work at W3C was rechartered this Summer until 2015, and new work includes adding some JSON support to XSLT and XQuery.
This is still work in progress, so the designs are not final: there are a lot of details to be worked out, not least because JSON and XML have some deep-rooted differences.
The biggest difference is social: JSON is often used in environments where programmers get to decide what format is used for data that their program will use. XML is often used where the same information is shared between many programs, possibly including some unknown programs, and where the data is owned by its creators, who are not necessarily programmers.
A consequence of this difference is that XML tends to be much harder for programmers to deal with than JSON, because it wasn’t primarily designed for them.
But to the point here, JSON parsing and generation can be harder than it looks using XML tools, and we want to make it easy for the XML world to interoperate with JSON APIs and data.
There are two main approaches that make sense when integrating data formats:
- Convert the data at the system boundary;
- Extend the core to handle both types of data
The current XSLT 3 draft provdes a parse_json() function to turn JSON into a specific internal representation in its existing tree-based data model, and another function to take such a data model instance and turn it into JSON. Then you can use standard XSLT templates, XPath, functions and operators to process the JSON data.
XQuery will also add the new map data type, and will probably add arrays. In the database environment where XQuery often lives it’s not so easy to determine the proper relationship between the new data structures and the database, so that’s ongoing.
The upshot will be that XSLT 3 and XQuery 3.1 will have access to JSON data, the ability to generate JSON, and also tools to work with JSON in a query or transformation.