com.jayway.jsonpath.InvalidPathException: Failed to parse SliceOperation: :

Pentaho BI Platform Tracking | Carlos Russo | 9 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    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}

    Pentaho BI Platform Tracking | 9 months ago | Carlos Russo
    com.jayway.jsonpath.InvalidPathException: Failed to parse SliceOperation: :
  2. 0

    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}

    Pentaho BI Platform Tracking | 9 months ago | Carlos Russo
    com.jayway.jsonpath.InvalidPathException: Failed to parse SliceOperation: :
  3. 0

    Values with spaces not working

    GitHub | 2 months ago | ammar-khan
    com.jayway.jsonpath.InvalidPathException: Use bracket notion ['my prop'] if your property contains blank characters. position: 51
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Not working with single array element

    GitHub | 2 months ago | ammar-khan
    com.jayway.jsonpath.InvalidPathException: Could not parse token starting at position 31. Expected ?, ', 0-9, *
  6. 0

    Hydrator: JSON Parser Issue!

    Google Groups | 4 days ago | Girish Kumar
    java.lang.Exception: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: com.jayway.jsonpath.InvalidPathException: Could not parse token starting at position 1. Expected ?, ', 0-9, *

    Root Cause Analysis

    1. com.jayway.jsonpath.InvalidPathException

      Failed to parse SliceOperation: :

      at com.jayway.jsonpath.internal.path.ArraySliceOperation.parse()
    2. com.jayway.jsonpath
      PathCompiler.compile
      1. com.jayway.jsonpath.internal.path.ArraySliceOperation.parse(ArraySliceOperation.java:70)
      2. com.jayway.jsonpath.internal.path.PathCompiler.readArrayToken(PathCompiler.java:332)
      3. com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:105)
      4. com.jayway.jsonpath.internal.path.PathCompiler.readPropertyOrFunctionToken(PathCompiler.java:175)
      5. com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:117)
      6. com.jayway.jsonpath.internal.path.PathCompiler.readDotToken(PathCompiler.java:137)
      7. com.jayway.jsonpath.internal.path.PathCompiler.readNextToken(PathCompiler.java:111)
      8. com.jayway.jsonpath.internal.path.PathCompiler.readContextToken(PathCompiler.java:90)
      9. com.jayway.jsonpath.internal.path.PathCompiler.compile(PathCompiler.java:42)
      10. com.jayway.jsonpath.internal.path.PathCompiler.compile(PathCompiler.java:57)
      10 frames
    3. Json Path
      JsonPath.compile
      1. com.jayway.jsonpath.JsonPath.<init>(JsonPath.java:101)
      2. com.jayway.jsonpath.JsonPath.compile(JsonPath.java:467)
      2 frames
    4. org.pentaho.di
      StepInitThread.run
      1. org.pentaho.di.trans.steps.jsoninput.reader.FastJsonReader.compilePaths(FastJsonReader.java:129)
      2. org.pentaho.di.trans.steps.jsoninput.reader.FastJsonReader.<init>(FastJsonReader.java:78)
      3. org.pentaho.di.trans.steps.jsoninput.reader.FastJsonReader.<init>(FastJsonReader.java:83)
      4. org.pentaho.di.trans.steps.jsoninput.JsonInput.createReader(JsonInput.java:429)
      5. org.pentaho.di.trans.steps.jsoninput.JsonInput.init(JsonInput.java:89)
      6. org.pentaho.di.trans.steps.fileinput.BaseFileInputStep.init(BaseFileInputStep.java:127)
      7. org.pentaho.di.trans.step.StepInitThread.run(StepInitThread.java:69)
      7 frames
    5. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:745)
      1 frame