Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

error loc.indexOf is not a function #181

Copy link
Copy link
@thboileau

Description

@thboileau
Issue body actions

Describe the bug

I get this error with a specific expression: loc.indexOf is not a function

Code sample or steps to reproduce

Given this json payload:

{
  "stores": [
    { "name": "Store 1"},
    { "name": "Store 2" },
    { "name": "Store 3" },
    { "name": "Store 4"}
  ]
}

When I apply this path $.stores[1:4:2][(@.length-1)].name
Then I get an error: loc.indexOf is not a function.

Please note that this expression ($.stores[1:4:2]) returns:

[
  { "name": "Store 2" },
  { "name": "Store 4" }
]

And this expression ($.stores[(@.length-1)].name) returns:

[
  "Store 4"
]

Expected behavior

There should be no error.

Expected result

"Store 4"

Environment (IMPORTANT)

  • JSONPath-Plus version: 7.2.0

Desktop**

  • OS: Linux Ubuntu 20.04
  • Browser Chrome, version 107.0.5304.87
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.