skip to Main Content

Function to return all related data from json list using any given key

I have the following json data about experts. result={ "experts":[ { "thumbnail": "https://scholar.googleusercontent.com/citations?view_op=small_photo&user=JicYPdAAAAAJ&citpid=2", "name": "Geoffrey Hinton", "link": "https://scholar.google.com/citations?hl=en&user=JicYPdAAAAAJ", "author_id": "JicYPdAAAAAJ", "email": "Verified email at cs.toronto.edu", "affiliations": "Emeritus Prof. Comp Sci, U.Toronto & Engineering Fellow, Google", "cited_by": 638900, "interests": [ {…

VIEW QUESTION

Python format json for saving to file

My data looks like this: Key1: [Key2:[{},{},...{}]] The code something like this: dict_={} dict_['Key2']=all_items dict_fin={} dict_fin['Ke1']=[dict_] df=pd.DataFrame(dict_fin) df.to_json(filepath, orient="records",lines=True) I would like to have saved json like this: { "Key1": [{"Key2" : [{},{},...,{}]}] } Instead, I get it like this:…

VIEW QUESTION
Back To Top
Search