Skip to content

Why do filter only work on lists? #27

Description

@Ronserruya

I initially opened this issue on the jsonpath-ng repo, but it looks like the filtering there was just taken from this repo.

h2non/jsonpath-ng#30

In order to get the facebook URL from this:

{
   "websites":{
      "items":[
         {
            "type":"Website",
            "properties":{
               "updated_at":1553902435,
               "website_name":"homepage",
               "website_type":"homepage",
               "created_at":1395793311,
               "url":"http://***.com"
            }
         },
         {
            "type":"Website",
            "properties":{
               "updated_at":1553902435,
               "website_name":"facebook",
               "website_type":"facebook",
               "created_at":1395793311,
               "url":"https://www.facebook.com/***"
            }
         },
         {
            "type":"Website",
            "properties":{
               "updated_at":1553902435,
               "website_name":"twitter",
               "website_type":"twitter",
               "created_at":1395793311,
               "url":"https://www.twitter.com/***"
            }
         }
      ]
   }
}

I need to use websites.items[?(@.properties.website_type == 'facebook')].properties.url

Why does websites.items.[*].properties[?(@.website_type == 'facebook')].url not work?

or parse('a[?(@.b > 1)]').find({'a': {'b': 2}}) , they work with other online implementations like http://jsonpath.herokuapp.com/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions