jg-rp / json-p3 Goto Github PK
View Code? Open in Web Editor NEWJSONPath, JSON Patch and JSON Pointer for JavaScript
Home Page: https://jg-rp.github.io/json-p3/
License: MIT License
JSONPath, JSON Patch and JSON Pointer for JavaScript
Home Page: https://jg-rp.github.io/json-p3/
License: MIT License
To solve a problem with node locations generated when using the non-standard keys selector (~
), we need a way to conditionally select an object's keys, which could also be useful aside from creating valid node locations.
Whereas the standard filter selector ([? <expression>]
) selects values from an array or object when the expression evaluates to true
, the keys filter selector would select keys instead of values. Syntax for this could be [?~ <expression>]
or [~? <expression>]
.
Alternatively (or additionally), we could implement a key selector ("key" singular), which selects the key if it exists. Syntax could be $.obj.~name
or $.obj[~'name']
or $.obj[~"name"]
. Without this we could use the proposed keys filter selector like this:
[~? # == 'name']
But that would not be a singular query and the key selector would.
The *lazyResolve
method of SliceSelector
uses the non-lazy private slice
method. We should add a generator version of slice
, which should be more memory efficient when used on large arrays with large slice ranges.
Lines 212 to 217 in d0bd351
Considering our abstract class JSONPathSelector
, and the absence of a JSONPathSegment
class, we are currently blurring the lines between segments and selectors.
We should refactor to follow the JSONPath model described in RFC 9535 by implementing a JSONPathSegment
class, where all JSONPathSelector
instances belong to a segment, even shorthand selectors. In turn, a JSONPath expression (currently JSONPath
and should be JSONPathQuery
or JSONPathExpression
to match terminology from RFC 9535) should be made up of segments only.
This diagram illustrates what we want.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.