com.jayway.jsonpath.InvalidPathException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • The JsonPath specification allows looping over the items in an array via the slice operator [start:end:step] Looping over all items can either be achieved by using [:] or [*] PDI currently fails to recognize the syntax [:], but recognizes [0:] Take the JSON object {code} {"roles":["A","B","C"]} {code} Using $.roles[*] or $.roles[0:] to extract the values works as expected, but attempting to parse $.roles[:] leads to the following exception: {quote} 2016/05/09 12:36:00 - $.roles[:].0 - ERROR (version 7.0-SNAPSHOT, build 1 from 2016-03-28 23.32.40 by buildguy) : Error initializing step [$.roles[:]] 2016/05/09 12:36:00 - $.roles[:].0 - ERROR (version 7.0-SNAPSHOT, build 1 from 2016-03-28 23.32.40 by buildguy) : com.jayway.jsonpath.InvalidPathException: Failed to parse SliceOperation: : 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.ArraySliceOperation.parse(ArraySliceOperation.java:70) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readArrayToken(PathCompiler.java:332) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:105) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readPropertyOrFunctionToken(PathCompiler.java:175) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:117) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readDotToken(PathCompiler.java:137) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:111) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readContextToken(PathCompiler.java:90) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.compile(PathCompiler.java:42) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.compile(PathCompiler.java:57) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.JsonPath.<init>(JsonPath.java:101) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.JsonPath.compile(JsonPath.java:467) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.steps.jsoninput.reader.FastJsonReader.compilePaths(FastJsonReader.java:129) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.steps.jsoninput.reader.FastJsonReader.<init>(FastJsonReader.java:78) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.steps.jsoninput.reader.FastJsonReader.<init>(FastJsonReader.java:83) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.steps.jsoninput.JsonInput.createReader(JsonInput.java:429) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.steps.jsoninput.JsonInput.init(JsonInput.java:89) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.steps.fileinput.BaseFileInputStep.init(BaseFileInputStep.java:127) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.step.StepInitThread.run(StepInitThread.java:69) 2016/05/09 12:36:00 - $.roles[:].0 - at java.lang.Thread.run(Thread.java:745) {quote}
    via by Carlos Russo,
  • The JsonPath specification allows looping over the items in an array via the slice operator [start:end:step] Looping over all items can either be achieved by using [:] or [*] PDI currently fails to recognize the syntax [:], but recognizes [0:] Take the JSON object {code} {"roles":["A","B","C"]} {code} Using $.roles[*] or $.roles[0:] to extract the values works as expected, but attempting to parse $.roles[:] leads to the following exception: {quote} 2016/05/09 12:36:00 - $.roles[:].0 - ERROR (version 7.0-SNAPSHOT, build 1 from 2016-03-28 23.32.40 by buildguy) : Error initializing step [$.roles[:]] 2016/05/09 12:36:00 - $.roles[:].0 - ERROR (version 7.0-SNAPSHOT, build 1 from 2016-03-28 23.32.40 by buildguy) : com.jayway.jsonpath.InvalidPathException: Failed to parse SliceOperation: : 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.ArraySliceOperation.parse(ArraySliceOperation.java:70) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readArrayToken(PathCompiler.java:332) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:105) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readPropertyOrFunctionToken(PathCompiler.java:175) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:117) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readDotToken(PathCompiler.java:137) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:111) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.readContextToken(PathCompiler.java:90) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.compile(PathCompiler.java:42) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.internal.path.PathCompiler.compile(PathCompiler.java:57) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.JsonPath.<init>(JsonPath.java:101) 2016/05/09 12:36:00 - $.roles[:].0 - at com.jayway.jsonpath.JsonPath.compile(JsonPath.java:467) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.steps.jsoninput.reader.FastJsonReader.compilePaths(FastJsonReader.java:129) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.steps.jsoninput.reader.FastJsonReader.<init>(FastJsonReader.java:78) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.steps.jsoninput.reader.FastJsonReader.<init>(FastJsonReader.java:83) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.steps.jsoninput.JsonInput.createReader(JsonInput.java:429) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.steps.jsoninput.JsonInput.init(JsonInput.java:89) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.steps.fileinput.BaseFileInputStep.init(BaseFileInputStep.java:127) 2016/05/09 12:36:00 - $.roles[:].0 - at org.pentaho.di.trans.step.StepInitThread.run(StepInitThread.java:69) 2016/05/09 12:36:00 - $.roles[:].0 - at java.lang.Thread.run(Thread.java:745) {quote}
    via by Carlos Russo,
  • Values with spaces not working
    via GitHub by ammar-khan
    ,
  • Hydrator: JSON Parser Issue!
    via by Girish Kumar,
    • com.jayway.jsonpath.InvalidPathException: Failed to parse SliceOperation: : at com.jayway.jsonpath.internal.path.ArraySliceOperation.parse(ArraySliceOperation.java:70) at com.jayway.jsonpath.internal.path.PathCompiler.readArrayToken(PathCompiler.java:332) at com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:105) at com.jayway.jsonpath.internal.path.PathCompiler.readPropertyOrFunctionToken(PathCompiler.java:175) at com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:117) at com.jayway.jsonpath.internal.path.PathCompiler.readDotToken(PathCompiler.java:137) at com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:111) at com.jayway.jsonpath.internal.path.PathCompiler.readContextToken(PathCompiler.java:90) at com.jayway.jsonpath.internal.path.PathCompiler.compile(PathCompiler.java:42) at com.jayway.jsonpath.internal.path.PathCompiler.compile(PathCompiler.java:57) at com.jayway.jsonpath.JsonPath.<init>(JsonPath.java:101) at com.jayway.jsonpath.JsonPath.compile(JsonPath.java:467) at org.pentaho.di.trans.steps.jsoninput.reader.FastJsonReader.compilePaths(FastJsonReader.java:129) at org.pentaho.di.trans.steps.jsoninput.reader.FastJsonReader.<init>(FastJsonReader.java:78) at org.pentaho.di.trans.steps.jsoninput.reader.FastJsonReader.<init>(FastJsonReader.java:83) at org.pentaho.di.trans.steps.jsoninput.JsonInput.createReader(JsonInput.java:429) at org.pentaho.di.trans.steps.jsoninput.JsonInput.init(JsonInput.java:89) at org.pentaho.di.trans.steps.fileinput.BaseFileInputStep.init(BaseFileInputStep.java:127) at org.pentaho.di.trans.step.StepInitThread.run(StepInitThread.java:69) at java.lang.Thread.run(Thread.java:745)

    Users with the same issue

    Dunmer
    1 times, last one,