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

Pentaho BI Platform Tracking | Carlos Russo | 7 months ago
  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 | 7 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 | 7 months ago | Carlos Russo
    com.jayway.jsonpath.InvalidPathException: Failed to parse SliceOperation: :
  3. 0

    Filter: [?] can not be applied to primitives.

    GitHub | 9 months ago | marcingrzejszczak
    com.jayway.jsonpath.InvalidPathException: Filter: [?] can not be applied to primitives. Current context is: { "path" : "/api/12", "correlationId" : 123456 }
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    JsonPath with lambda expressions behaves differently than heroku app

    GitHub | 6 months ago | vasanthykolluri
    com.jayway.jsonpath.InvalidPathException: Filter: [?]['store']['book'][?]['pages']['count'] can not be applied to primitives. Current context is: [{"store":{"book":[{"category":"reference","pages":{"count":10}}]},"source":"me"}]
  6. 0

    Regression from 0.9.1

    GitHub | 2 years ago | niclash
    com.jayway.jsonpath.InvalidPathException: Filter: [0] can only be applied to arrays. Current context is: 51.968503937007874

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    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