JSONata logo Four months after the first release of the JSONata query language, we’re happy to announce the release of JSONata, Version 1.1! Over the past few months, JSONata has been adopted as the expression language within the hugely successful Node-RED project, and is being used for its advanced querying capabilities within the IBM Blockchain Fabric Composer. It’s also being used to add sophisticated transformation capabilities to the IBM App Connect graphical data mapper.

What’s new?

Version 1.1 is the next milestone release and adds some exciting features to the language:
  • Regular expressions. You can now perform complex text queries can thanks to a new simple regex syntax. Also, there’s a set of new functions to match, query, split, and transform string data. For example: Account.Order.Product[ProductName.$contains( /h.*t/ )].ProductID This example uses a regex to filter the array of products, and means that more complex queries can be expressed in a compact form.
  • Function chaining. Simplify the use of multiple functions within a data transformation expression using the new function chaining operator (~>). For example: Customer.Email ~> $substringAfter("@") ~> $substringBefore(".") ~> $uppercase() Here, the chaining operator looks tidier than writing functions that are nested inside other functions.
  • Function signatures. Use a new flexible syntax to define the function signatures. JSONata now has a built-in validator that checks for correct function invocation at runtime and throws errors for invalid use. This means you won’t need to write validation code. For example:
      $pad:= function($ch, $n)<sn:s>{ [1..$n].($ch) ~> $join() };
      $pad('x', 4)
    Here the <sn:s> syntax tells us (and the runtime) that our $pad function takes a string and a number, and returns a string. It then throws an error if given anything else.
  • Error codes. Errors now have error codes, with message lookup pushed to the edge. This allows alternative and translated message catalogs to be defined in the future.

What’s next?

We’ve come a long way, but there’s still a lot to do. Here’s my current wish list:
  • Better documentation. The current documentation needs to be restructured and provide much more detail, with many more examples. The docs are open source too, so please feel free to contribute.
  • More work on the JSONata exerciser. The syntax highlighting for JSONata expressions needs improving, and the ability to save and share your expressions would be cool.
  • Support for asynchronous functions when running in node.js. At least two users have asked for this, and it looks like an interesting challenge!
  • A native Java implementation. A number of users have requested this, and some work is already underway.
Please keep the requests coming in. It’s easy to get in touch — raise an issue on GitHub or join us on Slack. Make sure you visit jsonata.org to learn more and experiment with JSONata on your data!

Join The Discussion

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