How To Convert List Of Json Frames To Json Frame
I want to convert List of JSON object ot Single JSON frame Here is my code for i in user1: name=i.name password=i.password id1=i.id user = { 'name' : name,
Solution 1:
json.dumps()
returns a string, so you're append strings to userid
—and thus end up with the list of strings shown.
If you want a dictionary of dictionaries using the id
as the primary key, all you need is:
users = {i.id: {"name": i.name, "password": i.password} for i in user1}
Post a Comment for "How To Convert List Of Json Frames To Json Frame"