RuddenberryL / json-path

Automatically exported from code.google.com/p/json-path
0 stars 0 forks source link

Bad expansion of input "$[" #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 bertrand...@gmail.com on 16 Sep 2011 at 9:13

GoogleCodeExporter commented 9 years ago

Original comment by kalle.st...@gmail.com on 28 Feb 2012 at 1:09