I would like to reopen the discussion on adding conditionals to the parse notation. There are two other (non stream based) jsonpath npm packages out there (jsonpath-plus and jsonpath) which have full use of the conditionals in the specification. I have a requirement for a library of mine where the logic for querying json has to be defined entirely separate from evaluated code. I love the idea of using streams as my query engine, since the incoming data comes from a node-fetch stream and after parsing is sent to an observable, but if I cannot do complex filtering, then I have no way of using JSONStream
There is an old issue on this repo #106 where you mention
It's interesting that you use the JSONPath expression though, when I was first implementing this, I did investigate several implementations of JSONPath-like things, but none of them where sufficiently stream-oriented to adapt to streaming json.
If this is still the case, can you elaborate? If not, could we discuss how it could be implemented in the future? I would be happy to open a PR if you have an implementation in mind.
example syntax
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{
"category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
},
{
"category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
]
}
}
I would like to reopen the discussion on adding conditionals to the parse notation. There are two other (non stream based) jsonpath npm packages out there (jsonpath-plus and jsonpath) which have full use of the conditionals in the specification. I have a requirement for a library of mine where the logic for querying json has to be defined entirely separate from evaluated code. I love the idea of using streams as my query engine, since the incoming data comes from a
node-fetch
stream and after parsing is sent to an observable, but if I cannot do complex filtering, then I have no way of usingJSONStream
There is an old issue on this repo #106 where you mention
If this is still the case, can you elaborate? If not, could we discuss how it could be implemented in the future? I would be happy to open a PR if you have an implementation in mind.
example syntax
e.g.
$.book[?(@.category=='fiction')]
Thank you for this library! Btw if you are interested, I have put together a performance comparison of all the json querying npm packages https://github.com/andykais/json-querying-performance-testing