Description

Easy conversion between JSON atoms and Prolog terms. Because the notation is nearly identical to JSON, one can copy and paste examples from API documentation, add variables and immediately have working code. The library also makes it easy to describe complex, nested JSON objects.

We also recognize the inherent ambiguity of JSON serialization. Because JSON rarely indicates an object's type, we can't be certain which Prolog term represents it best. Instead of making you choose one, library(djson) bactracks over possible representations. This allows the context inherent in your code to clarify which representation is wanted.

It's common for web services to return JSON with a great deal of extraneous information. We rarely care about all of it. This library makes it easy to extract the pieces you want. The last example in the Synopsis above extracts a person's name from inside a nested JSON object. This pattern allows one to reuse predicates across different JSON documents, as long as they share the same structure.