Skip to content

map_values does not work? #80

Description

@doowhtron

pyjq==2.4.0
jq version: 1.6

I wanna filter some certain objects with jq. Seems there's a bug with map_values function.

With jq, it works fine:

echo '{"a": {"status": 1, "elapsed": 12}, "b": {"status": 0, "elapsed": 11}}' | jq 'map_values(select(.status==1))'

returns:
{
  "a": {
    "status": 1,
    "elapsed": 12
  }
}

But with pyjq:

data={"a": {"status": 1, "elapsed": 12}, "b": {"status": 0, "elapsed": 11}}
pyjq.first('map_values(select(.status==1))', data)

returns
None

Try
pyjq.first('map_values(select(.status<1))', data)

returns
{'b': None}

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