Skip to content
Advertisement

Tag: json

Mapping complex JSON to Pandas Dataframe

BackgroundI have a complex nested JSON object, which I am trying to unpack into a pandas df in a very specific way. JSON Objectthis is an extract, containing randomized data of the JSON object, which shows examples of the hierarchy (inc. children) for 1x family (i.e. ‘Falconer Family’), however there is 100s of them in total and this extract just

Convert nested list to JSON using Python

I’m using the following SQL query to get data for every month in a given year: When I’m returning this via Python, I’m getting the following result: Also, there are n everywhere in the result. I need the result in JSON format, but I can’t get it right. How can I do it? Answer If l is the list you

trying to get specific data from API response

Trying to get “equity” data from a API response for calculate but can’t get through. This is my code: Keep getting TypeError: And this is data I am trying to tear apart: Answer Done with this type, go through json.dumps and json.loads and track the data in equity to get number in json

python – json , how to make a json flat

so i have a nested json that contains two groups , each group has a field that contains more sub groups i would like to pop all the sub groups out to flatten the json and remove the sub groups field What is the correct way to do it JSON : This is the expected result: I need to pop

Extract specific value from JSON with Python

I am trying to get all the websites from this json file Unfortunately, when I use this code: I get following error: Any help is appreciated. Thank you in advance Answer Use raw data to get raw json and then iterate over ‘tokens’ attr of the response object:

Return JSON object with a “header”

I have an API, where I need to return data. I want to make a “header”, where I specify the amount of tutors, the call returned. My current function looks like this: This is an example, of the response. ] I’d like to add a header, that specifies the amount of tutors/arrays that the response returned. So it would be

Extract HTML into JSON with pyhton BeautifulSoup

The problem I’m trying to parse some blocks of HTML to store the relevant data in a JSON object but I’m struggling with the way BeautifulSoup’s treatment of child tags clashes with my specific requirements. Eample input: Desired output: My attempt Here’s my best attempt so far: Which produces the following output: You can see I have three issues: The

Advertisement