Skip to content

Tag: json

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 …

Identifying empty list in JSON data in Python

I have a json data set I’m trying to insert into a database. To do so, I need placeholders “” for non-existent data. In the example below, if there’s no email address, I need the insert statement to be (….,”boo”,….) instead of (….,”me@mail.com”…

Pandas won’t create CSV file?

just trying to save websockets to CSV’s. But it just doesnt make the file. Nothing in the directory. Tried running VScvode as admin, moving folder out of C: drive to documents .. nothing. no csv file, and no error. and no information on the internet about this either. So i kept stripping down the code t…