I have an JSON input coming into AWS Glue Job (python shell) from an Lambda function which I need to convert into pandas dataframe which will be consumed by the rest of the process.
Input JSON:
[{"ABC": "123", "CDE": "AB", "locations": [{"state": "FL", "city": "Orlando", "zip": "10001"}]},
{"ABC": "456", "CDE": "CD", "locations": [{"state": "AL", "city": "AnotherCity"}]}]
Output Dataframe:
ABC CDE locations_state locations_city locations_Zip
123 AB FL Orlando 10001
456 CD AL AnotherCity Null
I tried using the below json_normalize but in Glue job json normalize is not recognized. Any other inputs would be helpful.
df = pd.json_normalize(jsoninputstring, "locations", ['ABC','CDE'])
Thanks.