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

JSONPath supports function evaluation from global scope #53

Copy link
Copy link
@quantumlicht

Description

@quantumlicht
Issue body actions

For me this is actually not a bug, but a useful feature that could be more user friendly or implemented in a better way.

By reading the source code it seems that the eval function has access to the global scope when evaluating expressions in parenthesis.

For instance, if I first define a parsing function, say:

parser = function(param){console.log(param);return '1,2,3,4,5'};

I can do something like that

JSONPath({},data, '$..book[0].category[(parser\(@\))]')

Where data is the same json as defined in the doc. Would it be possible to implement a regexp parser using this method?

I feel like regular expression is a missing feature in general and I would prefer not to use this hack.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No 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.