Add support for sorting by json path
See original GitHub issueIt would be nice to have the ability to sort the query results by a path of a JSON columns For example, for a table like
CREATE TABLE products (
id serial NOT NULL PRIMARY KEY,
translated_name jsonb NULL
);
I would like to have the ability to do something like
query productsSortedByName {
products(order_by: {translated_name: {path: "en", how: asc_nulls_last}}) {
id
name: translated_name (path: "en")
}
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:43
- Comments:19 (1 by maintainers)
Top Results From Across the Web
Is it possible to get a sorted list of attribute values from a JSON ...
This is a source I found suggesting sorting is supported but it might be product-specific? I'm using http://www.jsonquerytool.com/ to test this.
Read more >JSONPath — Gabbi documentation
JSONPath expressions are provided by jsonpath_rw, with jsonpath_rw_ext custom extensions to address common requirements: Sorting via sorted and [/property] .
Read more >JSONPath Support - Kubernetes
JSONPath Support · Use double quotes to quote text inside JSONPath expressions. · Use the range , end operators to iterate lists. ·...
Read more >Sorting, Grouping and Aggregation · JSONata
The order-by operator is a convenient syntax that can used directly in a path expression to sort the result sequences in ascending or...
Read more >Working with data and jsonpaths | Tray.io Documentation
When you are wanting to 'pull' data from one service in order to 'push' it ... can determine the prefix for a jsonpath...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
At the very least, we should be able to sort by a named path
so for a data jsonb column like this
data: { "amount": 10 }
and a query like thissometable { timestamp data amount: data(path: "amount") }
You could sort by this"orderBy": [{"amount": "asc"}]
+1