'list of Json to dataframe in python

I want to convert a list of JSON strings into a proper DataFrame.

input:

x=['{"a":{"df":"9.0"},"b":{"df":"1234"}}',
   '{"a":{"fg":"3.0"},"b":{"fg":"1234"}}']

expected output:

a       t        b
9.0     df      1234 
3.0     fg      1234 

I tried the following codes but it did not work.

pd.DataFrame.from_records(x)
pd.DataFrame.from_dict(x)

Maybe its requires iteration, I am not sure about that.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source