Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]: Use jq instead of JSONPath for filtering JSON #4067

Open
1 task done
KaKi87 opened this issue May 15, 2024 · 2 comments
Open
1 task done

[feature]: Use jq instead of JSONPath for filtering JSON #4067

KaKi87 opened this issue May 15, 2024 · 2 comments
Labels
feature New feature or request

Comments

@KaKi87
Copy link

KaKi87 commented May 15, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Summary

Use jq instead of JSONPath for filtering JSON.

Why should this be worked on?

The syntax is more intuitive :

Action jq JSONPath
Get full data . $.
Get object property .name $.name
Get first array item .[0] $.[0]
Get first array item property .[0].name $.[0].name
Get first array item subproperty .[0].owner.username $.[0].owner.username
Filter array by item property .[] | select(.id == 411) $[?(@.id == 411)]
Filter array by item subproperty .[] | select(.owner.id == 1) $[?(@.owner.id == 1)]
Filter array by item property range .[] | select(.stars_count > 0) $[?(@.stars_count > 0)]
Get property of array items filtered by property range .[] | select(.stars_count > 0) | .name $[?(@.stars_count > 0)].name
Sort array items by property . | sort_by(.id) Feature missing
Filter and sort array map(select(.stars_count > 0)) | sort_by(.id) Feature missing
Get property of filtered and sorted array items map(select(.stars_count > 0)) | sort_by(.id) | .name Feature missing
Filter array by item property via regex .[] | select(.created_at | test("^202[34]")) $[?(/^202[34]/.test(@.created_at))]

Etc...


Thanks

@KaKi87 KaKi87 added the feature New feature or request label May 15, 2024
@anmol-fzr
Copy link

Hi 👋, I would like to work on this issue. Can you assign this issue to me.

@KaKi87
Copy link
Author

KaKi87 commented May 30, 2024

Hi, I don't have the permission to assign, but feel free to work on this, I'm looking forward to it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants