Answer the question
In order to leave comments, you need to log in
How to deal with complex json correctly in python?
Good afternoon.
Unfortunately, Google did not provide an answer to this question.
There is an API server that issues a huge JSON sheet for requests, containing both the data that I need and a bunch of useless data. At the same time, the data that I need can be at the 5-6th nesting level and it is not very beautiful to search for them through cycles.
What remedy have I found now.
I used a service that converts a list of Python classes from my JSON file and creates several parser functions. As a result, I pass my JSON response to the class constructor and get the opportunity to work with the request more conveniently.
However, due to their large nesting, calling some value deep in the bowels of JSON is not convenient.
I also saw a way in which the received JSON is converted to XML and then through lxml (or something else) we are looking for what we need using Xpatch.
What are the ways to facilitate this process? If I know which path this element is in.
For example, you can use xPath to search in html, maybe there is something for json?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question