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

High level interface to iterate over lists #83

Closed
TekTimmy opened this issue Jan 26, 2023 · 3 comments
Closed

High level interface to iterate over lists #83

TekTimmy opened this issue Jan 26, 2023 · 3 comments
Labels

Comments

@TekTimmy
Copy link

TekTimmy commented Jan 26, 2023

Is your feature request related to a problem? Please describe.
I have a JSON with a very large list of objects:

{
  "Modifications": [
    {"object_number": 1},
    {"object_number": 4532432}
  ]
}

Describe the solution you'd like
I would like to have a high level method to iterate over each entry in the Modifications list without having to use the low level API.

Describe alternatives you've considered
use the low level API

Additional context

@rtobar
Copy link

rtobar commented Jan 26, 2023

@TekTimmy Could you describe in more detail (some code) what were you trying? It sounds like what you want should be possible already using ijson.items(f, "Modifications.item") (with f being your opened file-like object where we can read the JSON data from), and indeed it's the usual go-to method that most people use.

@rtobar
Copy link

rtobar commented Jan 31, 2023

@TekTimmy hello?

@TekTimmy
Copy link
Author

TekTimmy commented Feb 1, 2023

Sorry for the late reply @rtobar ! Yes you are right, I did not try that because from the docs I understood that its for iterating object members only.. Thank you!

@TekTimmy TekTimmy closed this as completed Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants