Comments (3)
@hyusetiawan Hi, apologies for the lack of documentation. I haven't really found the time yet.
This library has a very simple API which contains one method query(<query>, <obj>)
, Unfortunately, it does not have all the niceties around returning paths. It very much only focuses on the results of a query, rather than where those results were found. It does however support a few extensions on the usual JSONPath implementation, which allow things like the apply example. To achieve the same result, you should be able to do something like:
import query from '@f5io/jsonpath';
const obj = { ... } // the object to be queried
const results = query('$..author[!(@.toUpperCase())]', obj);
As you can see, the [!(..)]
syntax is a simple map expression.
I appreciate the libraries focus on pure results might not be for everyone's use-case, however this was developed as a basis for my simple jsont implementation.
I hope this helps. I promise I will get down to doing docs as soon as I have some time. Let me know if I can help with anything else.
from jsonpath.
i end up using the library and write a simple wrapper around it, luckily the library returns the same referenced objects in the result as in the passed in object to be queried so i can just apply() over those. Knowing the limitation I can't mutate primitives but i have to return the enclosing object, but i'll live :)
Of all the jsonpath i've tried, this is the easiest to get started with, the others i've tried have not been easy to setup.
Thanks!
from jsonpath.
Ah, sorry, I missed the mutate bit. Yes, returning the enclosing object and mutating there is a good solution.
from jsonpath.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonpath.