Comments (12)
Strongly disagree, I think leading zeros should be an error, particularly as they are in JSON proper. There is no benefit to allowing them, they add nothing, except confusion whether this represents octal notation or not.
from json-path-comparison.
You could always use your prerogative as owner of this site to say a resounding no! to the consensus on this:-) My own view is that the representation of numbers shouldn't differ from ECMA-404. Moreover, most of the JSONPath implementations lack a formal grammar, so it can be hard to tell whether a "feature" has been intended or merely reflects absent validation. For instance I doubt whether any implementation intended to support octal notation for array indexing, as some have. More likely the unintended consequence of using a general purpose to_integer
function.
from json-path-comparison.
The JSON spec for numbers disallows leading zeroes. I'm tending towards making leading zeroes a syntax error. (This will also allow implementations to add octal support as a strict extension of Proposal A if they choose to.)
from json-path-comparison.
Here's the second example: https://cburgmer.github.io/json-path-comparison/results/array_slice_with_step_and_leading_zeros.html
You can see for one there's a consensus, for the other currently not.
That was I think the only motivation to currently not support it. I'll document that. As always, happy to discuss :)
from json-path-comparison.
I think that classic octal notation with leading zero is highly confusing for many modern users. I think that there's no reason to forbid leading zeros. My implementation fails to parse them right now, but I tend to consider it a bug.
But maybe it's wise to forbid leading zeros explicitly.
from json-path-comparison.
@danielaparker Great point about leading zeroes not being valid in JSON. Case closed?
from json-path-comparison.
If we say we don't support leading zeros for Proposal A, then we would have our first case where we advocate for not supporting something while the consensus offers a result.
from json-path-comparison.
most of the JSONPath implementations lack a formal grammar, so it can be hard to tell whether a "feature" has been intended or merely reflects absent validation
I tend to share this point of view.
I'd like to mention that some implementations allow using JSON object literals. Now let's remember that JSON scalars are also valid JSON documents; so maybe it would be convenient just to delegate JsonPath scalars to JSON spec? I mean, we can just use strict JSON syntax subset for defining JsonPath literals, including:
- strings/integers in bracket notation;
- integers in array slices;
- any valid JSON document as literal in filters.
from json-path-comparison.
@remorhaz Agree that wherever possible a formalization of JSONPath should refer to existing specifications.
from json-path-comparison.
Now let's remember that JSON scalars are also valid JSON documents; so maybe it would be convenient just to delegate JsonPath scalars to JSON spec?
Just to call out a limitation to that suggestion: we would have to separately support strings with single quotes. Some implementations even support arrays of strings with single quotes.
from json-path-comparison.
Dark ages of JsonPath have ruined my beautiful idea, alas. But I still think that we should keep as close to existing JSON spec as possible; something like STRING_KEY ::= JSON_STRING | SINGLE_QUOTED_STRING
. And this derives another problem - of extending JSON values, like this: $.foo[?(@.bar=={"a":'b'})]
. I mean, the question is: if we allow single-quoted strings in bracket-child, should we forbid them elsewere?
from json-path-comparison.
But I still think that we should keep as close to existing JSON spec as possible; something like
STRING_KEY ::= JSON_STRING | SINGLE_QUOTED_STRING
.
Agreed.
And this derives another problem - of extending JSON values, like this:
$.foo[?(@.bar=={"a":'b'})]
. I mean, the question is: if we allow single-quoted strings in bracket-child, should we forbid them elsewhere?
I think so, since implementations will want to use an existing JSON parser for parsing JSON values.
from json-path-comparison.
Related Issues (20)
- Is it possible to provide JSONPath test cases based on consensus results HOT 7
- Show footnote 4 if applicable on the query detail page
- Need test for filter expression checking for local key in array with a null value
- Alignment with spec in its current state (a report) HOT 7
- Incorporating and merging with the compliance test suite HOT 3
- Add nimma
- Include github.com/SteelBridgeLabs/jsonpath HOT 1
- Failing build of Java implementations in the docker container HOT 1
- Add serde_json_path HOT 2
- Add jpt HOT 2
- Bump JsonPath.Net to v1.0.0 HOT 3
- Comparing dotNET_JsonPathLib questionable
- Project governance HOT 7
- Link to reference implementation
- Support for path axis navigation HOT 11
- Issue with display of queries containing the * character HOT 1
- Expand on type of consensus HOT 2
- Tests for root reference in filter expressions. HOT 3
- Analysis HOT 2
- provide key for table contents HOT 8
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 json-path-comparison.