I am sending JSON data over post method to one of my ML models, the problem is it is not able to pick which object to fetch for fields.
Below is the sample JSON
{
"a": {
"asD": 1553990400000,
"cust": "S65A00",
"party": "1234",
"custS": null,
"sngldt: 1557014400000,
},
"b": {
"History": [],
"cust": "S65A00",
"mb_cntry": "US",
"mbdt": 1490918400000,
"mbsg_dt": 1553904000000,
}
}
How Can I Merge this JSON in the ML Code in single braces like below, I don't have the luxury to format the JSON itself during Post request.
{
"asD": 1553990400000,
"cust": "S65A00",
"party": "1234",
"custS": null,
"sngldt: 1557014400000,
"History": [],
"mb_cntry": "US",
"mbdt": 1490918400000,
"mbsg_dt": 1553904000000,
}
Below is the code that I have tried but failing
@app.route('/', methods=['GET', 'POST'])
def execute():
if request.method == 'POST':
json_data = request.get_json()
batch=json.dumps(json_data)
dataFrame = pd.DataFrame(json_data)
print(len(dataFrame.columns))
df=pd.melt(dataFrame,id_vars=[' ','b'], value_name='values')
print(df)