We pull some data from a URL. The data comes down as one huge string, but within it is delimited into small lists / pairs. A small sample of the data is here:
[{"date_of_fix ":"9\/4\/2023","fix_description":"Broken report links\r","issue_no ":"1788"},{"date_of_fix ":"8\/30\/2023","fix_description":"Icon on password fields","issue_no ":"1769"},{"date_of_fix ":"8\/21\/2023","fix_description":"Add Tracking to Quote Page\r","issue_no ":"1744"}]
Would like to convert this to a dataframe, so I can later insert it into Oracle. But it is coming down as one huge delimited string, so not sure how to loop / split / convert / append this onto a dataframe.
Any help would be awesome.
Thanks!
>Solution :
If you are getting such string with three items in each, you can use pandas read_json() function for this.
import pandas as pd
received_str = '[{"date_of_fix ":"9\/4\/2023","fix_description":"Broken report links\r","issue_no ":"1788"},{"date_of_fix ":"8\/30\/2023","fix_description":"Icon on password fields","issue_no ":"1769"},{"date_of_fix ":"8\/21\/2023","fix_description":"Add Tracking to Quote Page\r","issue_no ":"1744"}]'
df = pd.read_json(received_str)
The resulting dataframe (df) should have three columns.