We are proud to announce version 1.2 of the JSONata query and transformation language. JSONata is an open source, declarative language for extracting and manipulating JSON data. It includes first-class syntax for predicate-based queries, grouping, aggregation, and formatting of the result structure.
In version 1.2, we added more built-in functions together with some extra syntax to allow query results to be sorted. Also, we’ve added support for plugging in asynchronous functions, making this library a better citizen in the Node.js ecosystem.
What’s new to JSONata 1.2?
- New ‘order-by’ syntax. This new syntax allows you to specify how to order the results of a query. Without this, the results of a query will be returned in document order, or the order in which they appear in the input JSON. Using this new syntax, you can order your results according to one or more sort terms. These terms can be anything from a simple property reference to a complex expression. For example, you can set a query to order by increasing price or decreasing age, or some other metric that can be extracted from the data.
As an example,
Account.Order.Product^(>Price, <Quantity)orders the products primarily by decreasing price, but for products of the same price, by increasing quantity.