It seems like every few months I have a project where I need to parse some JSON and pull out certain parts. Maybe the JSON came in JSON files, or maybe I retrieved it from an API. The duration between each of these occasions is long enough that I’ve had to relearn some basics each time, so a year or two ago I made a sample JSON file that demonstrates a few data structures and features, and then I wrote a Python demo script that parses them. Now I look at that script to review the basics…
When I was at TopQuadrant, I learned that their SPARQLMotion scripting language had a module that could convert JSON to RDF. This had nothing to do with JSON-LD—it worked with any JSON at all, using blank nodes to indicate the grouping of data within arbitrary structures.
Last month I wrote about how we can treat the growing amount of JSON-LD in the world as RDF. By “treat” I mean “query it with SPARQL and use it with the wide choice of RDF application development tools out there”. While I did demonstrate that JSON-LD does just fine with URIs from outside of the schema.org vocabulary, the vast majority of JSON-LD out there uses schema.org.
I paid little attention to JSON-LD until recently. I just thought of it as another RDF serialization format that, because it’s valid JSON, had more appeal to people normally uninterested in RDF. Dan Brickley’s December tweet that “JSON-LD is much more widely used than Turtle” inspired me to look a little harder at the JSON-LD ecosystem, and I found a lot of great things. To summarize: the amount of JSON-LD data out there is exploding, and we can query it with SPARQL, so…