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

Selector for JSON contents #95

Open
roniemartinez opened this issue Mar 18, 2022 · 0 comments
Open

Selector for JSON contents #95

roniemartinez opened this issue Mar 18, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@roniemartinez
Copy link
Owner

roniemartinez commented Mar 18, 2022

There are existing ways to extract data from JSON without traversing the contents one by one.

Options

Proposed style

@select(jsonpath="$.store.book[0].title")
def extract_title(title):
    return {"title": title}


@select(jmespath="locations[?state == 'WA'].name | sort(@)")
def extract_washington_cities(cities):
    return {"cities": cities}

Notes

  • Only applies if content type is application/json
@roniemartinez roniemartinez added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Mar 18, 2022
@roniemartinez roniemartinez self-assigned this May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant