Skip to content

Tag: json

Unable to scrape jpg images link from json

I’m trying to scrape jpg images from each products, every product url saved in csv. Image links are available in json data so try to access json key value. When I try to run code it’s only getting back with all key value in spite of image url link, and second my code only able to scrape last product url

Get nested Json data into pandas DataFrame

I need to get the below Json data into a pandas DataFrame. This is a case of nested JSON which consists of multiple lists and dicts . Expected format as follows: enter image description here Answer Try: Prints:

Convert html table to json with BeautifulSoup

I am trying to convert HTML table to json using beautifulsoup() function python, I was able to convert but the data coming in wrong json format. The above code prints JSON in the below format. I would like to get it in below format Some help is appreciated Answer The output you want is not a valid format, so you

Modify multiple json files

I have a folder with 2000 json files and I have to edit specific line with number based on file name. files names :- each file contain text like below:- 1.json 2.json Currently no is not in correct order. I want to make like this : 1.json 2.json 100.json I have done something like this this is works for 1

How do I get a specific element from a json string?

I have a JSON string (not in a file): [{‘x’: 403.5, ‘y’: 53.0, ‘width’: 117, ‘height’: 106, ‘class’: ‘fruitflies’, ‘confidence’: 0.626}, {‘x’: 446.0, ‘y’: 189.0, ‘width’: 124, ‘height’: 130, ‘class’: ‘fruitflies’, ‘confidence’: 0.528}], now as you can see, the entire string is in a list. Inside the list is the dictionary. There are 2 dictionaries in the list and I

Python: when trying to extract certain keys, how can I avoid a KeyError when in some dict elements, the key value is missing from APi json?

I can successfully extract every column using Python, except the one I need most (order_id) from an API generated json that lists field reps interactions with clients. Not all interactions result in orders; there are multiple types of interactions. I know I will need to add the flag to show ‘None’ and then in my for loop and an if-statement

Python read txt file and save it as json with keys

I have a txt file that presents some data as follow: The file is all structured in the same way, but I wanted to convert this file to a JSON format. Based on my experience, I decided to go first with a split to have a list to play with: This outputs the text as follow: which is perfect. Here

How to concatanate 2 dictionaries in 2 json files

Iam trying to append a dictionary in one json file to a dictionary in another json file. here are json file r1 json file r2 The result Iam looking for is Expected result My code is not returning the expected results Answer As the ‘Adrian shum’ said your json having the lists. in that case you can use nested for