Introducing SBD-JPath

SBD-JPath is an expression language that allows the processing of json data. Core ideas for this language were inspired from the XPath 3.1 language and JSONPath.

There are many json processing languages and libraries already, so why SBD-JPath, yet again another one? SBD-JPath introduces a number of features not yet seen in competitors, to wit:

  • A formal language specification
  • Language features inspired by XPath 3.1, including maps and functions
  • A syntax closer to XPath
  • Ability to navigate “up” the tree (that is to say, to reference ancestor nodes)
  • Greater extensibility, with the ability to externally provide functions

This blog post is merely an introduction to the concept of SBD-JPath. A series of future blog posts, taken together will comprise the language specification. We will start with a data model, the specify core concepts and core operators, and then finally I will specify non-core inbuilt functions and operators.

SBD-JPath will be instrumental in the development of another language, as yet unnamed, similar to XSLT 3.0, which seeks to transform json data into html fragments and visa-versa.

Just to wet your appetite, here is a sample task and solution provided by SBD-JPath.
In this task, we have sales data from a fruit vendor. What is the SBD-JPath expression to return the volume of sales? The sales data is thus:

{
  "apple":{
    "price": 3.10,
    "quantity": 100
    },
  "orange":{
    "price": 1.50,
    "quantity": 20
    }
}

The task answer is thus:

  sum( */(price * quantity))

So dear reader, read my future blog posts to receive the full specification.

This entry was posted in SBD-JPath. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments Protected by WP-SpamShield Spam Plugin