ruddenberryl / json-path Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/json-path
Automatically exported from code.google.com/p/json-path
By default JAXB (in Jersy) uses $ for @XMLValue values.
This results in the following JSON: `"foo" : {"@id" : "123", "$" : "hello"}`.
I want to get the "hello" out of this JSON using JsonPath, but can't: `foo.@id`
returns `"123"`, but `foo.$` returns `{"@id" : "123", "$" : "hello"}`.
Original issue reported on code.google.com by [email protected]
on 5 Apr 2013 at 2:32
What version of the product are you using? On what operating system?
0.8.0 on Windows
Right now this library uses an older version of commons-lang, which should be
updated to the latest version. As in latest version they have changed package
names (lang to lang3) thus this library is not useful with latest version. So I
request to update the code accordingly and provide a jar that is compatible
with latest commons-lang version.
Currently there is one way to solve this issue, that is:
1. Get the latest source code of json-path from Github.
2. Change the import statements of commons-lang.
3. Build jar file out of it.
Still if owner could change it and provide it as general in the download
section then this will be much better.
Original issue reported on code.google.com by [email protected]
on 8 Jan 2013 at 7:22
Here is the stack trace:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at com.jayway.jsonpath.internal.filter.ArrayIndexFilter.filter(ArrayIndexFilter.java:66)
at com.jayway.jsonpath.internal.filter.PathTokenFilter.filter(PathTokenFilter.java:50)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:182)
...
The json-path query is "$.links[?(@.rel= 'item')][0].uri"
Original issue reported on code.google.com by [email protected]
on 23 Mar 2012 at 9:36
What steps will reproduce the problem?
1. Create an api key or use the attached download file and generate a Google
Places result. example:
https://maps.googleapis.com/maps/api/place/details/json?extensions&reference=CoQ
BcwAAAGUXL9IN3925iac5iG8il1Facl__usLd6e3PPV7jQyxbZTVyl0nGNQRw5WpF-i1AGhQNJ44WiVG
f7jxBVcU57bXWSWBYkd-Dz6DImh2SRJX4hvb8eXAMJm2ec7-d0F7QLWWY3xJcNw_PH5PgeMOB_BhRIjg
t49q2CFHCZlQUjj6sEhBz7Dj_32jVa0fkNtBJiOI6GhT6RKUr9TLWaXoLrRI5UmQakozLiQg&sensor=
true&key=AddYourOwnKeyHere
or use the sample json provided by Google at:
https://developers.google.com/places/documentation/details
PS, I'm not supposed to keep a copy of the json file according to the agreement
with Google but the error output does copy the original text.
2. attempt to use this source file as your json in a command like:
jsonpath $..website PlaceDetailsExtensionsResult.json >>output.txt 2>&1
or something like
require 'uri'
require 'net/http'
require 'rspec'
require 'jsonpath'
$uri = URI.parse("https://maps.googleapis.com")
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
def fetch(uri_str, limit)
raise ArgumentError, 'This application does not allow redirects' if limit == 0
response = Net::HTTP.get_response($uri + uri_str)
case response
when Net::HTTPSuccess then
#Net::HTTP.get_print($uri + uri_str)
response
when Net::HTTPRedirection then
location = response['location']
newLocation = location.gsub(Regexp.new(Regexp.escape($uri.to_s)),'')
warn "redirected to #{location}"
fetch(newLocation, limit - 1)
else
response.value
end
end
json_call = 'maps/api/place/nearbysearch/json?key=AIzaSyCzh625_u4LOd3LcOOIyqiE3uBMfso48cg&sensor=false&location=53.541195,-113.490331&radius=200&types=bakery|bar|cafe|night_club|bar|restaurant'
json = fetch(json_call,1).body
JsonPath.on(json, '$..reference')
3. Receive an error about invalid json... which is technically correct against
RFC 4627. However, the JSON input is valid in JavaScript.... check it out at
http://www.freeformatter.com/json-validator.html.
What is the expected output? What do you see instead?
Need to be able to use the Javascript form of valid JSON, especially since such
major backers as Google are taking shortcuts.
What version of the product are you using? On what operating system?
The Ruby implementation on Windows, Ruby 2.0.0, json-1.8.0
Please provide any additional information below.
The issue seems to be the difference between requiring a value with quotes
within in a blank entry. I'm still looking for anything that would
automatically reformat it from the Javascript version to the standard
Original issue reported on code.google.com by [email protected]
on 13 Sep 2013 at 7:44
Attachments:
Hi,
some tests fails on java 8 [1], Fedora 22 Linux all arch
any ideas?
thanks in advance
regards
Used
maven 3.2.3
OpenJDK version "1.8.0_11"
OpenJDK Runtime Environment (build 1.8.0_11-b12)
OpenJDK Zero VM (build 25.11-b02, interpreted mode)
hamcrest 1.3
jackson 1.9.
json-smart 1.3 (git commit 4fe12e8129ccd25498c5d88f5b16bf3984269cc7)
junit 4.11
[1]
Tests run: 10, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.113 sec <<<
FAILURE! - in com.jayway.jsonpath.ExpressionEvalTest
not_equal_in_and_operator_filter(com.jayway.jsonpath.ExpressionEvalTest) Time
elapsed: 0.059 sec <<< FAILURE!
org.junit.ComparisonFailure: expected:<[{"o[ccupation":"Farm boy","name":"Luke
Skywalker","aliases":["Nerf herder"],"offspring":null]}]> but
was:<[{"o[ffspring":null,"aliases":["Nerf herder"],"occupation":"Farm
boy","name":"Luke Skywalker"]}]>
at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at com.jayway.jsonpath.ExpressionEvalTest.not_equal_in_and_operator_filter(ExpressionEvalTest.java:208)
and_operator_in_filter(com.jayway.jsonpath.ExpressionEvalTest) Time elapsed:
0.003 sec <<< FAILURE!
org.junit.ComparisonFailure: expected:<[{"o[ccupation":"Farm boy","name":"Luke
Skywalker","aliases":["Nerf herder"],"offspring":null]}]> but
was:<[{"o[ffspring":null,"aliases":["Nerf herder"],"occupation":"Farm
boy","name":"Luke Skywalker"]}]>
at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at com.jayway.jsonpath.ExpressionEvalTest.and_operator_in_filter(ExpressionEvalTest.java:197)
Tests run: 26, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.845 sec <<<
FAILURE! - in com.jayway.jsonpath.JsonPathTest
all_store_properties(com.jayway.jsonpath.JsonPathTest) Time elapsed: 0.006 sec
<<< ERROR!
com.jayway.jsonpath.PathNotFoundException: Path token: '[0]' not found.
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:258)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:215)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:447)
at com.jayway.jsonpath.JsonPathTest.all_store_properties(JsonPathTest.java:224)
Original issue reported on code.google.com by [email protected]
on 22 Aug 2014 at 2:12
What steps will reproduce the problem?
1. JsonPath: $.project[?(@.template.@key == 'foo')].field[*].@key
2. Json Object: (lengthy, see attachment)
3. List<String> fields = JsonPath.read(jsonData, jsonPath);
What is the expected output? What do you see instead?
Should return a List<String> which contains all the "@key" field values of the
"field" substructure ("Artist", ...) , but throws ClassCastException instead.
What version of the product are you using? On what operating system?
V. 0.8.0 on Win7 64 bit / Java 6 / Tomcat 6.
Please provide any additional information below.
java.lang.ClassCastException: net.minidev.json.JSONObject cannot be cast to
java.util.List
at com.jayway.jsonpath.spi.impl.AbstractJsonProvider.toList(AbstractJsonProvider.java:55)
at com.jayway.jsonpath.internal.filter.ArrayEvalFilter.filter(ArrayEvalFilter.java:40)
at com.jayway.jsonpath.internal.filter.PathTokenFilter.filter(PathTokenFilter.java:50)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:182)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:202)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:307)
Original issue reported on code.google.com by [email protected]
on 9 Jan 2013 at 7:36
Attachments:
Applying
$.store.book[?( (@.category=='reference' && @.author=='Nigel Rees') )]
on below json doesn't return any books (returns []), it should actually return
the first record.
The java script version of json path returns the first object in the book array.
{ "store": {
"book": [
{ "category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{ "category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
},
{ "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
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
}
}
Version used: 0.8.1
OS is mac os x lion.
Original issue reported on code.google.com by [email protected]
on 3 Jul 2012 at 12:30
The library is great - thanks! One question - does this library support a
JSONPath syntax for doing multiple OR'ed expressions? I figured out you could
do this for AND:
$..book[?(@.price>10)][?(@.price<20)]
but can I do OR logical expressions also? In the javascript version, you can do:
$..book[?(@.price<10 || @.price>20)]
for OR and for AND:
$..book[?(@.price>10 & @.price<20)]
Thanks
Ian
Original issue reported on code.google.com by [email protected]
on 18 Feb 2013 at 6:23
Json blocks which are arrays must have array syntax first. If not,
ArrayIndexFilter throws NPE.
What steps will reproduce the problem?
1. Json like: [{\"a\":[{\"b\":1,\"c\":2}]}]
2. jsonpath like: $.a.b
3. calling JsonPath.read("[{\"a\":[{\"b\":1,\"c\":2}]}]", "$.a");
What is the expected output? What do you see instead?
Expected output is null because the json is an array and needs a [X] to address
an element.
Actual output:
java.lang.NullPointerException
at com.jayway.jsonpath.internal.filter.ArrayIndexFilter.filter(ArrayIndexFilter.java:66)
at com.jayway.jsonpath.internal.filter.PathTokenFilter.filter(PathTokenFilter.java:50)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:182)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:202)
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:307)
at me.(JUnitTestClass.java:52)
What version of the product are you using? On what operating system?
Happens in 0.8.0, also 0.8.2
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 6 Feb 2013 at 8:07
What steps will reproduce the problem?
1. The library is not usable with Android
2.
3.
What is the expected output? What do you see instead?
isEmpty method of the String object is not available in Android.
What version of the product are you using? On what operating system?
current
Please provide any additional information below.
A patch was created:
https://github.com/ikamobile/JsonPath/commit/b6b0b58a8fd5066a0b4eeedf072b274fd7b
1dc87#commitcomment-1360031
Please add it to the main branch.
Original issue reported on code.google.com by [email protected]
on 22 May 2012 at 1:31
assert that a given field is not defined
with(json).assertNotDefined("$.some.path")
Original issue reported on code.google.com by [email protected]
on 8 Feb 2011 at 1:33
What steps will reproduce the problem?
1. When I try to access this json {"contents": ["one","two","three"]}
by executing this expression "$.contents[?(@=='two')]"
What is the expected output? What do you see instead?
"two" should be returned, but instead an empty result is returned.
The same happens for other filters like [?(@>2)]
What version of the product are you using? On what operating system?
0.8.1
Please provide any additional information below.
This behaviour is needed to verify for example that a value is contained in an
array. When filtering a map array this works, in the json {"contents":
["reference":"one","reference":"two"]} expression
"$.contents[?(@.reference=='two')]" returns an element.
Original issue reported on code.google.com by [email protected]
on 21 Feb 2013 at 4:12
What steps will reproduce the problem?
1. Use this JSON:
{
"product": [ {
"version": "3.5.5",
"codename": "Seattle"
},
{
"version": "4.0",
"codename": "Montreal"
}]
}
2. Use this predicate:
$.product[?(@.version = '4.0')].codename
3. Expect to get Montreal but get empty object.
What is the expected output? What do you see instead?
[] instead of ["Montreal"]
What version of the product are you using? On what operating system?
3.5.5
Please provide any additional information below.
The problem is in PathUtil.splitPath:
public static List<String> splitPath(String jsonPath) {
LinkedList<String> fragments = new LinkedList<String>();
if (!jsonPath.startsWith("$.")) {
jsonPath = "$." + jsonPath;
}
jsonPath = jsonPath.replace("$['","$.['")
.replaceAll("\\['(\\w+)\\.(\\w+)']", "['$1~$2']")
.replace("']['","'].['" )
.replace("..", ".~~.")
.replace("[", ".[")
.replace("@.", "@")
.replace("['", "")
.replace("']", "");
String[] split = jsonPath.split("\\.");
The split picks up also what's inside the predicate '...'.
Original issue reported on code.google.com by [email protected]
on 16 Sep 2011 at 7:06
What steps will reproduce the problem?
1. With a given json of
{ "store": {
"book": [
{ "category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{ "category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99,
"isbn": "0-553-21311-3"
}
]
}
}
2. And if you run:
Object returnValue = JsonPath.read(givenJson, "$.bicycle.color");
What is the expected output? What do you see instead?
I would expect the returned value to be null. Because a path of "$.bicycle"
would return null. Instead the returned value is "".
What version of the product are you using? On what operating system?
0.9.1 on Windows 7.
Please provide any additional information below.
When searching for a nested object if the parent object is null will return an
empty string. However, if searching for the parent object the returned value is
null. And if the parent object exists but is empty searching for the nested
object would then return null as well.
Original issue reported on code.google.com by [email protected]
on 8 Jul 2014 at 10:11
Given this JSON : {"test":null}
JsonPath.read(json, "test") returns null
JsonPath.read(json, "nonExistingProperty") returns null
JsonPath.read(json, "nonExisting.property") throws a PathNotFoundException
I expect JsonPath.read(json, "nonExistingProperty") to throw a
PathNotFoundException as well, so I can make a difference between my json null
property and properties that does not exist.
Original issue reported on code.google.com by [email protected]
on 14 Jan 2014 at 8:50
Hi,
XPath has XPathVariableResolver which provides access to user-defined
variables. Using this, XPath substitutes a variable during evaluation.
Does JsonPath have this implemented.? Please let me know.
I don't see it being implemented in google's java implementation of JsonPath.
I am not sure where to post this to get an answer. Sorry for the trouble.
I tried at couple of places but have not got any response.
Thanks!
Original issue reported on code.google.com by [email protected]
on 30 Jan 2014 at 1:00
In 1.9.1, I'm trying to implement a JsonProvider for Java 8's Nashorn native
javascript objects. jdk.nashorn.internal.objects.NativeArray is used to
represent JS arrays, but it doesn't implement Iterable. I can't write a
JsonProvider that can work with NativeArray, for the sole reason that
com.jayway.jsonpath.spi.JsonProvider.createArray() returns Iterable. In all
uses of createArray(), the variable that createArray() is assigned to is
Object. There's also a method JsonProvider.toIterable() which can take care of
converting the Object to Iterable when necessary. This method signature just
doesn't seem to fit with the rest of the interface.
Original issue reported on code.google.com by [email protected]
on 24 Jun 2014 at 7:45
What steps will reproduce the problem?
1. Use json-path as dependency and compile with JDK 5
What is the expected output? What do you see instead?
It should build. I get:
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation
failure
<http://xxx.java>:[8,-1] cannot access com.jayway.jsonpath.JsonPath
bad class file:
/var/opt/data/hudson/localrepo/com/jayway/jsonpath/json-path/0.8.1/json-path-0.8
.1.jar(com/jayway/jsonpath/JsonPath.class)
class file has wrong version 50.0, should be 49.0
I assume it won't run either
What version of the product are you using? On what operating system?
0.8.1
Is there an earlier version I could use?
Original issue reported on code.google.com by [email protected]
on 7 Aug 2012 at 6:49
I'm working on a project that uses json.org's JSON implementation. I have
created a JsonProvider (attached) which seems to work. With the one exception
that JSONPath.read(Object jsonObject) does not use the JsonProvider to check
for Map/List types.
In previous versions I was able to work around this by passing in a list of
JSONObject's. But this no longer seems to works.
Please consider the following change, which solves my problem:
https://github.com/mephillips/JsonPath/commit/df802bb52c78d5a535f2ad603d187ae950
42bcdf
Original issue reported on code.google.com by [email protected]
on 1 Aug 2012 at 8:12
Attachments:
What steps will reproduce the problem?
Try to parse JSON like:
{"text" : "skill: \"Heuristic Evaluation\"", "country" : ""}
What is the expected output? What do you see instead?
I'm getting the error:
com.jayway.jsonpath.InvalidJsonException: Unexpected token euristic
Evaluation"",
"country" at position ...
However the provided JSON is completely valid and should be parsed well.
What version of the product are you using? On what operating system?
0.8.1
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 31 May 2013 at 12:21
Hi,
This is not an issue, it is more like a feature request or the desire to open a
discussion i suppose :-)
So I wanted to use jsonpath for implementing filtering on my command line tool
that deals with json data. I wanted to be able to express things like:
Do something with the given json item if: a.b==3 AND a.d!="cheese" AND a.c<2.
Programmatically, the JsonAssert style assertions are a great way to do this.
In fact I've written some code that chains a set of these assertions together
and accepts items accordingly. However, the input is quite dirty!
If the values being checked happened to be list items, i.e. the json looked
like: {"a":[{"b":1}]} then as jsonpath input one can write things like:
a[?(@.b==1)]. Nice and tidy. However, assertions against non-list values seem
to be not syntactically supported.
My current "massive hack"(tm) is to accept strings like: a.b:==1 and split on
:== and then build the assertion, taking the first half as the jsonpath and the
second half as the value to test equality against.
This is obviously not a great idea, not to mention requiring to split strings,
it doesn't support complex assertions yet, and to do so would be horrible
(given the current way im doing it)
So questions! Is there already a way to express the kind of filter? If not, is
there a plan to build assertions into jsonpath syntax? If so, can i help? :-)
Cheers!
- Sina
Original issue reported on code.google.com by [email protected]
on 14 Apr 2012 at 1:46
Json Document Example:
{ "arrayOfObjectsAndArrays" : [ { "k" : ["json"] }, { "k":["path"] }, { "k" :
["is"] }, { "k" : ["cool"] } ],
"arrayOfObjects" : [{"k" : "json"}, {"k":"path"}, {"k" : "is"}, {"k" : "cool"}]
}
What steps will reproduce the problem?
1. Given the Json Document Example (above)
2. Given at least the v 0.8.1 of the json-path jayway implementation
3. When you use any of these json-paths: $.arrayOfObjects..k and $.
arrayOfObjectsAndArrays..k
4. Then the result is this for both json-paths listed above:
["json","path","is","cool"]
What is the expected output? What do you see instead?
The expected output is: ["json","path","is","cool"] and
[["json"],["path"],["is"],["cool"]] respectively.
What version of the product are you using? On what operating system?
The version is 0.8.1
Please provide any additional information below.
In 0.8.1 the cause of this issue is an addAll during traversal when an element
is a list. This addAll ends up adding the contents of the list rather than the
list themselves into the final result.
Original issue reported on code.google.com by [email protected]
on 18 Sep 2013 at 3:19
JsonPath.read(sourceJson.clone(), sourcePathStr);
Even I clone sourceJson I still get this exception
When a lot of threads accessing the same JsonPath code.
What is the expected output? What do you see instead?
No ConcurrentModificationException
What version of the product are you using? On what operating system?
Linux, json-path 0.5.3
Please provide any additional information below.
java.util.ConcurrentModificationException: null
at java.util.HashMap$HashIterator.nextEntry(Unknown Source) ~[na:1.6.0_33]
at java.util.HashMap$ValueIterator.next(Unknown Source) ~[na:1.6.0_33]
at com.jayway.jsonpath.filter.TraverseFilter.traverse(TraverseFilter.java:33) ~[json-path-0.5.3.jar:na]
at com.jayway.jsonpath.filter.TraverseFilter.traverse(TraverseFilter.java:42) ~[json-path-0.5.3.jar:na]
at com.jayway.jsonpath.filter.TraverseFilter.apply(TraverseFilter.java:23) ~[json-path-0.5.3.jar:na]
at com.jayway.jsonpath.filter.JsonPathFilterChain.filter(JsonPathFilterChain.java:43) ~[json-path-0.5.3.jar:na]
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:109) ~[json-path-0.5.3.jar:na]
at com.jayway.jsonpath.JsonPath.read(JsonPath.java:160) ~[json-path-0.5.3.jar:na]
Original issue reported on code.google.com by [email protected]
on 19 Sep 2012 at 6:44
Hi,
I've made some modification to your splitPath method such that it covers more
than one degree of escaping for key values within [' '] and I've made escaping
for keys within parentheses.
Best regards,
PL
public static void main(String[] args) {
String jsonPath = "$.['test.something.allo'].[?(@attr.version.minor)].attr.GWVersion";
Pattern p = Pattern.compile("\\['(.*)'\\]");
Matcher m = p.matcher(jsonPath);
while(m.find()) {
String withinBrackets = m.group(1);
String withoutDot = withinBrackets.replace('.', '~');
jsonPath = m.replaceFirst("['" + withoutDot + "']");
}
jsonPath = jsonPath.replace("$['","$.['")
.replace("']['","'].['" )
.replace("..", ".~~.")
.replace("[", ".[")
.replace("@.", "@")
.replace("['", "")
.replace("']", "");
System.out.println(jsonPath);
p = Pattern.compile("\\(([^\\(\\)]*)\\)");
m = p.matcher(jsonPath);
while(m.find()) {
String withinBrackets = m.group(1);
String withoutDot = withinBrackets.replace('.', '~');
jsonPath = m.replaceFirst("(" + withoutDot + ")");
}
System.out.println(jsonPath);
}
Original issue reported on code.google.com by [email protected]
on 16 Sep 2011 at 10:23
The home page here on Google Code lists this Maven dependency:
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-assert</artifactId>
<version>0.8.1</version>
<scope>test</test>
</dependency>
The "scope" tag is improperly closed.
Original issue reported on code.google.com by [email protected]
on 10 Sep 2012 at 2:37
What steps will reproduce the problem?
1. Create a class with an Object field.
2. Create an instance of the class with the field set to new Double(8.95)
3. call ExpressionEvaluator.eval() with your object, "<", "10"
public class WrappedJsonValue {
Object value;
public WrappedJsonValue(Object value) {
this.value = value;
}
public Object getValue() {
return value;
}
public static void main(String[] args) {
boolean result = ExpressionEvaluator.eval(new WrappedValue(new Double(8.95)), "<", "10");
System.out.println(result);
}
}
What is the expected output? What do you see instead?
I would like it to evaluate the Double and return true. Instead, it returns
false because it can't handle a WrappedJsonValue object.
What version of the product are you using? On what operating system?
0.9.2-SNAPSHOT, windows
Please provide any additional information below.
My use case must maintain metadata associated with JSON values - offsets in the
source document. To accomplish this, I created the following:
1. a JsonProvider to wrap/unwrap values/arrays/maps as necessary
2. an extension of JSONParserString to override readArray, readObject, and
readMain to get offsets and return one of the classes described below.
3. an extension of JSONArray, adding an Offset field
4. an extension of JSONObject, adding an Offset field
5. a wrapper class with an Offset field and an Object - to be used where a
String, Boolean, or Number would otherwise be used
This covered all of my needs except evaluating expressions such as
$.store.book[?(@.price > 10)]. The ExpressionEvaluator class assumes it will
receive a String, Boolean, or Number.
I submitted a pull request with a very simplistic, but general solution.
Original issue reported on code.google.com by [email protected]
on 12 Nov 2013 at 10:27
With JSON {"a": {}} path $.a.x evaluates to null under version 0.9.1. It did
result to an InvalidPathException under version 0.8.1. Path $.a.x.y results to
an InvalidPathException under both versions.
Original issue reported on code.google.com by [email protected]
on 10 Jun 2014 at 3:11
What steps will reproduce the problem?
1. have a json oject with id
2. use path $.id
3. jsonPath throws exception
What is the expected output? What do you see instead?
I should be able to get the field
What version of the product are you using? On what operating system?
0.9.0 on a mac
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 11 Sep 2014 at 9:02
What steps will reproduce the problem?
Applying the following JSON Path '$.store.book[?(@.author.age == 36)]' on the
following JSON:
{ "store": {
"book": [
{ "category": "reference",
"author": {
"name": "Author Name",
"age": 36
},
"title": "Sayings of the Century",
"price": 8.95
},
{ "category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99,
"isbn": "0-553-21311-3"
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
}
}
What is the expected output? What do you see instead?
Expected output:
{ "category": "reference",
"author": {
"name": "Author Name",
"age": 36
}
"title": "Sayings of the Century",
"price": 8.95
}
Actual output:
[]
What version of the product are you using? On what operating system?
json-path version: Released 0.8.1
operating system: Windows 7
Please provide any additional information below.
It seems that if I provide a filter with dot notation e.g. '?(@.author.age ==
36)', the filter doesn't work. Filters like '?(@.category == 'reference')'
works correctly.
JsonPath.read(new File("json.txt"), "$.store.book[?(@.author.age == 36)]")) - []
JsonPath.read(new File("json.txt"), "$.store.book[?(@.category ==
'reference')]")) - [{"author":{"age":36,"name":"Author Name"},"title":"Sayings
of the Century","category":"reference","price":8.95}]
Original issue reported on code.google.com by [email protected]
on 4 Jun 2013 at 7:15
For the JSON body:
{
list: [{
name: 'My (String)'
}]
}
The path $.list[?(@.name == 'My (String)')] will return an empty list. Where as
$.list[?(@.name == 'My(String)')] will match.
Internally the path token is getting extracted as '@.name == 'My(String)'.
What version of the product are you using? On what operating system?
0.9.1
Original issue reported on code.google.com by [email protected]
on 13 Dec 2013 at 11:23
What steps will reproduce the problem?
1. mvn compile
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
git clone git://github.com/jayway/JsonPath.git on 4/7/2013
Please provide any additional information below.
898K downloaded (bndlib-1.50.0.jar)
[INFO] ------------------------------------------------------------------------
[INFO] Building json-path-parent-pom
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [enforcer:enforce {execution: enforce-maven}]
[INFO] ------------------------------------------------------------------------
[INFO] Building json-path
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
Downloading:
http://repo1.maven.org/maven2/net/minidev/json-smart/1.1.1/json-smart-1.1.1.pom
1K downloaded (json-smart-1.1.1.pom)
Downloading:
http://repo1.maven.org/maven2/net/minidev/parent/1.1.1/parent-1.1.1.pom
10K downloaded (parent-1.1.1.pom)
Downloading:
http://repo1.maven.org/maven2/org/codehaus/jackson/jackson-mapper-asl/1.9.5/jack
son-mapper-asl-1.9.5.pom
1K downloaded (jackson-mapper-asl-1.9.5.pom)
Downloading:
http://repo1.maven.org/maven2/org/codehaus/jackson/jackson-core-asl/1.9.5/jackso
n-core-asl-1.9.5.pom
1016b downloaded (jackson-core-asl-1.9.5.pom)
Downloading:
http://repo1.maven.org/maven2/org/hamcrest/hamcrest-library/1.2.1/hamcrest-libra
ry-1.2.1.pom
5K downloaded (hamcrest-library-1.2.1.pom)
Downloading:
http://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.2.1/hamcrest-core-1.2
.1.pom
5K downloaded (hamcrest-core-1.2.1.pom)
Downloading:
http://repo1.maven.org/maven2/org/hamcrest/hamcrest-library/1.2.1/hamcrest-libra
ry-1.2.1.jar
Downloading:
http://repo1.maven.org/maven2/org/codehaus/jackson/jackson-mapper-asl/1.9.5/jack
son-mapper-asl-1.9.5.jar
Downloading:
http://repo1.maven.org/maven2/net/minidev/json-smart/1.1.1/json-smart-1.1.1.jar
50K downloaded (json-smart-1.1.1.jar)
49K downloaded (hamcrest-library-1.2.1.jar)
Downloading:
http://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.2.1/hamcrest-core-1.2
.1.jar
760K downloaded (jackson-mapper-asl-1.9.5.jar)
Downloading:
http://repo1.maven.org/maven2/org/codehaus/jackson/jackson-core-asl/1.9.5/jackso
n-core-asl-1.9.5.jar
40K downloaded (hamcrest-core-1.2.1.jar)
223K downloaded (jackson-core-asl-1.9.5.jar)
[INFO] [enforcer:enforce {execution: enforce-maven}]
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory
/shared/JsonPath/json-path/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 37 source files to /shared/JsonPath/json-path/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] Building json-path-assert
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] snapshot com.jayway.jsonpath:json-path:0.8.2-SNAPSHOT: checking for
updates from sonatype-nexus-snapshots
Downloading:
https://oss.sonatype.org/content/repositories/snapshots/com/jayway/jsonpath/json
-path/0.8.2-SNAPSHOT/json-path-0.8.2-SNAPSHOT.jar
[INFO] Unable to find resource
'com.jayway.jsonpath:json-path:jar:0.8.2-SNAPSHOT' in repository
sonatype-nexus-snapshots
(https://oss.sonatype.org/content/repositories/snapshots)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) com.jayway.jsonpath:json-path:jar:0.8.2-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.jayway.jsonpath -DartifactId=json-path -Dversion=0.8.2-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.jayway.jsonpath -DartifactId=json-path -Dversion=0.8.2-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) com.jayway.jsonpath:json-path-assert:jar:0.8.2-SNAPSHOT
2) com.jayway.jsonpath:json-path:jar:0.8.2-SNAPSHOT
----------
1 required artifact is missing.
for artifact:
com.jayway.jsonpath:json-path-assert:jar:0.8.2-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots)
Original issue reported on code.google.com by [email protected]
on 6 Apr 2013 at 6:52
What steps will reproduce the problem?
1. Run the following unit test
public void testArrayIndexFilter()
{
ArrayIndexFilter filter = new ArrayIndexFilter("[1:]");
Object obj = JsonLibrary.parseJson("[0,1,2,3]");
JsonProvider provider = JsonProviderFactory.createProvider();
Object value = filter.filter(obj, provider);
}
What is the expected output? What do you see instead?
I expect 'value' to equal "[1,2,3]", but instead a NumberFormatException is
raised. I believe the problem is with the following line in ArrayIndexFilter:
trimmedCondition = trim(trimmedCondition.replace(" ", ""), 1, 1);
Shouldn't this be
trimmedCondition = trim(trimmedCondition.replace(" ", ""), 0, 1);
The way it is currently trimmedCondition = "" and clearly this is going to
cause a NumberFormatException when passing to Integer.parseInt()
What version of the product are you using? On what operating system?
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-assert</artifactId>
<version>0.8.1</version>
</dependency>
Additional Info:
-Can the Array Slice operator be implemented to adhere to the [start:end:step]
convention. Instead of just supporting [start:] and [:end], at the very least
could it please support [start:end]
-Also I believe 'end' is supposed to be absolute and not relative to the length
of the array. If you want to do something relative to the end of the array I
would suggest using negative values much like many other scripting languages
(ie Python)
Python Example:
>>> array=[0,1,2,3]
>>> array[0:]
[0, 1, 2, 3]
>>> array[-1:]
[3]
>>> array[:-1]
[0, 1, 2]
>>> array[0:3:2]
[0, 2]
>>> array[1:3:2]
[1]
>>> array[1:4:2]
[1, 3]
>>> array[0:4]
[0, 1, 2, 3]
May I propose the following public Object filter(Object, JsonProvider)
implementation that behaves the same as Python array slicing:
public Object filter(Object obj,JsonProvider jsonProvider, String condition) {
List<Object> src = jsonProvider.toList(obj);
List<Object> result = jsonProvider.createList();
// remove '[' and ']'
String trimmedCondition = trim(condition, 1, 1);
// resolve '@.length'
trimmedCondition.replaceAll("@.length", new Integer(src.size()).toString());
if(trimmedCondition.contains(":")){
String[] tokens = trimmedCondition.split(":");
int start = 0;
int end = src.size() - 1;
int step = 1;
try{
start = Integer.parseInt(tokens[0].trim());
if(start < 0){
start = src.size() + start;
}
}
catch(Exception ex){}
if(tokens.length > 1){
try{
end = Integer.parseInt(tokens[1].trim());
if(end < 0){
end = src.size() + end - 1;
}
else{
end -= 1;
}
}
catch(Exception ex){}
}
if(tokens.length > 2){
try{
step = Integer.parseInt(tokens[2].trim());
}
catch(Exception ex){}
}
if(step <= 0){
throw new RuntimeException("Step must be a positive value");
}
for(int i = start; i <= end; i+=step){
result.add(src.get(i));
}
return result;
}
else {
String[] indexArr = trimmedCondition.split(",");
for (String idx : indexArr) {
result.add(src.get(Integer.parseInt(idx.trim())));
}
return result;
}
}
Original issue reported on code.google.com by [email protected]
on 1 Oct 2012 at 3:35
ExpressionEvaluator.java doesn't take care of BigInteger and BigDecimal
Original issue reported on code.google.com by [email protected]
on 30 Apr 2012 at 9:11
I have the following JSON:
[
{
"id": "9",
"sku": "SKU-001",
"compatible": false
},
{
"id": "13",
"sku": "SKU-005",
"compatible": true
},
{
"id": "11",
"sku": "SKU-003",
"compatible": true
}
]
I want to filter only compatible SKUs, as follows:
String path = "$.[?(@.compatible)].sku";
What is the expected output? What do you see instead?
The expected output should be ["SKU-003","SKU-005"], but currently it brings a
collection with all the items ["SKU-001","SKU-005","SKU-003"]
What version of the product are you using? On what operating system?
Using 0.8.1 on Linux Ubuntu with JDK 1.7
Original issue reported on code.google.com by [email protected]
on 22 Sep 2013 at 2:53
What steps will reproduce the problem?
1. You have the following json:
{"list":
[
{
"a":"atext,
"b":{
"b-a":"batext,
"b-b":"bbtext"
}
},
{
"a":"atext2,
"b":{
"b-a":"batext2,
"b-b":"bbtext2"
}
}
]
}
2. you have a json path like: $.list[?(@.b.b-a=='batext2')]
3. or a filter like: JsonPath.read(result, "$.list[?]",
Filter.filter(Criteria.where("b.b-a").eq("batext2")));
What is the expected output? What do you see instead?
Actual: Empty list
Expected: a matching jsong object
What version of the product are you using? On what operating system?
0.8.1
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 19 Mar 2013 at 12:13
This should ignore whitespacing, order of fields etc.
It would be nice to add this to json-path and also add assertion method to
json-path-assert.
Original issue reported on code.google.com by [email protected]
on 1 Mar 2012 at 7:22
The source code shows many imports of org.hamcrest.* objects, but they are not
provided in the dependencies.zip file. There is no hint which version of the
hamcrest project was used for writing this library, either.
*If* a dependencies.zip file is provided, it should, imho, be complete.
Original issue reported on code.google.com by [email protected]
on 9 Jan 2013 at 9:27
Hi,
The PropertyFilter.PATTERN could be simplified to "(.*)" only because the
method PathUtil.splitPath() already took care of removing "['" and "']".
Regards,
PL
Original issue reported on code.google.com by [email protected]
on 16 Sep 2011 at 9:29
Currently the ExpressionEvaluator does not comparison of boolean type.
Test json
{ "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,
"retailer": null,
"children": true,
"number": -2.99
},
{ "category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99,
"number":0,
"children": false
}
]
}
}
using the expression "$.store.book[?(@.children==true)].title" should return
"Moby Dick".
---- crude patch ----
else if(actual instanceof Boolean){
Boolean a = (Boolean)actual;
Boolean e = Boolean.valueOf(expected);
if("==".equals(comparator)){
return a.equals(e);
} else if ("!=".equals(comparator) || "<>".equals(comparator)) {
return !a.equals(e);
}
}
Original issue reported on code.google.com by [email protected]
on 30 May 2012 at 8:42
What steps will reproduce the problem?
1. Json like: {\"a\":{\"b\":1,\"c\":2}}
2. jsonpath like: a.d
3. calling JsonPath.read("{\"a\":{\"b\":1,\"c\":2}}", "a.d");
What is the expected output? What do you see instead?
null
What version of the product are you using? On what operating system?
invalid path exception coming from: FieldFilter.java:59:
if(!map.containsKey(condition)){
throw new InvalidPathException("invalid path");
} else {
return map.get(condition);
}
Please provide any additional information below.
version: 0.8.1
Maybe I did something wrong, but why do not I get a null value with this call?
Original issue reported on code.google.com by [email protected]
on 2 Oct 2012 at 10:19
What steps will reproduce the problem?
1. Provide a JSONPath like "$[someBranch = 'abc'].someOtherBranch"
What is the expected output? What do you see instead?
In PathUtil.splitPath, the first statement:
if (!jsonPath.startsWith("$.")) {
jsonPath = "$." + jsonPath;
}
is doing an expansion to:
$.$[
It should probably be:
if (!jsonPath.startsWith("$.") && !jsonPath.startsWith("$[") {
jsonPath = "$." + jsonPath;
}
Then it does an expansion from this statement:
jsonPath = jsonPath.replace("$['","$.['")
...;
it expands it to:
$.$.[
What version of the product are you using? On what operating system?
0.5.5
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 16 Sep 2011 at 9:13
Given JSON like:
{ "foo" : [
{ "id": 1 },
{ "id": 2 },
{ "id": 3 }
] }
a JSON-path of "$.foo.id" should not match. But it does, and it produces
[1,2,3]. The correct syntax for that result would be "$.foo[*].id"
In particular this causes a problem when the foo array is empty, as an array is
still returned.
We use json-path in rest-driver
(https://github.com/rest-driver/rest-driver).and it has been a great help for
us. But our users are raising bugs due to this behaviour which we can't work
around :(
Original issue reported on code.google.com by [email protected]
on 28 Oct 2011 at 1:34
$.foo.bar
is the same as
$.['foo'].['bar']
Original issue reported on code.google.com by [email protected]
on 8 Feb 2011 at 7:38
Create a doc e.g. like this {"rootkey":{"sub.key":"value"}} and try to select
the value
with a path like "rootkey.sub.key" you will get a "PathNotFoundException"
stating that there is no key named sub.
Is it possible to express the path in some other way to get the value?
I'm on jsonpath 0.9.0!
/Jesper
Original issue reported on code.google.com by [email protected]
on 20 Feb 2014 at 2:38
What steps will reproduce the problem?
1. Given the following json object:
{
"datapoints":[
[
10.1,
13.0
],
[
21.0,
22.0
]
]
}
2. apply json path expression: $.datapoints.[*].[0]
What is the expected output? What do you see instead?
1) Expected output (try http://ashphy.com/JSONPathOnlineEvaluator/):
'0' => "10.1"
'1' => "21.0"
2) Got below instead:
'0' => "21.0"
'1' => "22.0"
What version of the product are you using? On what operating system?
Both version 0.5 & 0.9. OS -linux
Please provide any additional information below.
Using a similar XML and apply XPath expression
//response/datapoints/values/value[1] produced result agreed with the expected
output.
XML:
<response>
<datapoints>
<values>
<value>10.1</value>
<value>13.0</value>
</values>
<values>
<value>21.0</value>
<value>22.0</value>
</values>
</datapoints>
</response>
Apply XPath expr: //response/datapoints/values/value[1]:
Element='<value>10.1</value>'
Element='<value>21.0</value>'
Online XPath evaluator: http://www.freeformatter.com/xpath-tester.html#ad-output
Original issue reported on code.google.com by [email protected]
on 9 Oct 2013 at 10:39
What steps will reproduce the problem?
@Test
public void testNotDefined() throws Exception {
JsonAsserter asserter = JsonAssert.with("{\"foo\":\"bar\"}");
asserter.assertEquals("$.foo", "bar"); // pass
asserter.assertEquals("$foo", "bar"); // pass
asserter.assertNotDefined("$.xxx"); // fail but should be pass
asserter.assertNotDefined("$xxx"); // fail but should be pass
}
What version of the product are you using? On what operating system?
jsonpath,jsonasserter 0.91 from maven repository
Please provide any additional information below.
// com.jayway.jsonassert.impl.JsonAsserterImpl
// public JsonAsserter assertNotDefined(String path) {
//
// try {
// Object o = JsonPath.read(jsonObject, path); // <------ this
should produce InvalidPathException but was null
// throw new AssertionError(format("Document contains the path <%s>
but was expected not to.", path));
// } catch (InvalidPathException e) {
// }
// return this;
// }
Original issue reported on code.google.com by [email protected]
on 11 Nov 2013 at 2:16
json-path seems only compatible with hamcrest 1.1 (which have 1.2.1 released
already).
When I use hamcrest 1.2.1 with 0.5.6 when trying:
with(getResponseContent()).assertThat("errors",
hasItem("Product.code.NotBlank"));
I get:
java.lang.NoSuchMethodError:
org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Descriptio
n;)V
at org.hamcrest.core.IsCollectionContaining.matchesSafely(IsCollectionContaining.java:31)
at org.hamcrest.core.IsCollectionContaining.matchesSafely(IsCollectionContaining.java:14)
at org.hamcrest.TypeSafeDiagnosingMatcher.matches(TypeSafeDiagnosingMatcher.java:54)
at com.jayway.jsonassert.impl.JsonAsserterImpl.assertThat(JsonAsserterImpl.java:38)
at integration.resources.ProductsResourceIT.testCreateCodeNull(ProductsResourceIT.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:66)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:307)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:86)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:94)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:294)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:282)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:207)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:146)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:120)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:118)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:102)
at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Original issue reported on code.google.com by marceloverdijk
on 22 Feb 2012 at 1:07
Given some json:
{
"key": [
1, 2, 3
]
}
When I query for 'key.invalid'
Then I get 'null' - a valid json value
Current behavior is to return 'null' in this case. Looking at Issue 7 it
appears this was intentional.
However, it is confusing because 'null' is a valid json value... So it looks
like the key has a field 'invalid', and the value was 'null', when actually no
such field exists.
I would expect an InvalidPathException, which is what is thrown elsewhere when
queries are made for fields that do not exist.
What version of the product are you using? On what operating system?
master (5993e05b73c6fc1a4ad92048e2fd37edea38cf01) on Java 1.6 (OSX)
Will add pull request shortly.
Jack Singleton
Original issue reported on code.google.com by [email protected]
on 10 Jul 2013 at 7:06
Version 0.5.5
The PATTERN for ListEvalFilter incorrectly tests for property names that just
contain \\w chars, which is a class that does not include dashes ('-')
Here is a test case. Given this object:
{
"store":{
"book":[
{
"category":"reference",
"author":"Nigel Rees",
"title":"Sayings of the Century",
"display-price":8.95
},
{
"category":"fiction",
"author":"Evelyn Waugh",
"title":"Sword of Honour",
"display-price":12.99
},
{
"category":"fiction",
"author":"J. R. R. Tolkien",
"title":"The Lord of the Rings",
"isbn":"0-395-19395-8",
"display-price":22.99
},
],
"bicycle":{
"color":"red",
"display-price":19.95
}
}
}
This pattern does not return any results:
$.store.book[?(@['display-price'] < 10)].title
However, it does return one result when tested against the PHP version found
here:
http://jsonpath.curiousconcept.com/
Original issue reported on code.google.com by [email protected]
on 13 Dec 2011 at 11:59
What steps will reproduce the problem?
We have indefinite json path that points to more than one array:
jsonPath = "$..arr";
json:
{
obj1: {
arr: ["1", "2"]
},
obj2: {
arr: ["3", "4"]
}
}
What is the expected output? What do you see instead?
The read() method must return [["1", "2"], ["3", "4"]]
but it returns ["1", "2", "3", "4"]
What version of the product are you using? On what operating system?
version: 0.8.1
Please provide any additional information below.
The bug is in the FieldsFilter.
Original issue reported on code.google.com by [email protected]
on 7 Nov 2013 at 1:11
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.