JSON to JSON Conversions
This was originally a post that I submitted to LinkedIn, but there is enough useful information I wanted to capture it for the newsletter.
Converting from one schema (or, somewhat less precisely, ontology) to another is one of the bigger jobs an ontologist can take on, especially when such ontologies are large. If your content is expressed as XML, such transformations can be managed in a relatively straightforward manner with XSLT; if in Turtle, then you can use SPARQL with CONSTRUCT or (more effectively) DELETE/INSERT/WHERE statements.
However, JSON mappings don't necessarily have as clear a path. I ran across the JSON-converter library in Python recently that does a pretty good job of this, however. This uses the same fundamental concepts as XSLT - create a pattern-matching node to determine one's context in the old schema, then, once in that mode, replace that node with a corresponding node in the new schema. This can be invoked recursively as well. An analogous transformer can be found in Javascript land with awesome-json2json, which uses the new ECMAScript chaining operator (?.) and lambda functions, among other features.
It's worth noting that you can use these same libraries to generate mappings into specific document formats (such as HTML or MarkDown). XSLT is still more expressive (and XSLT can also do JSON mappings with XSLT 3). (Also added JSonata, thanks to a comment from Joshua Cornejo).
Note that the role of these tools is to allow you to interpret a map between schemas, but the actual map production is up to you. I'm working up an article now that gets into both of these tools more in-depth, and I will post it when done.
๐ JSON-Converter (Python)
๐ Awesome JSON2JSON (Javascript)
๐ JSonata (javascript)
๐ Transforming JSON Using XSLT 3


