I have 2 dataframes. I have to send these two dataframes in json format whenever the django API is called.
c = a.to_json(orient='records')
d = b.to_json(orient='records')
return JsonResponse(json.loads(c,d),safe = False)
a and b are dataframes
I'm getting error when I'm executing the above code. How to send the 2 separate dataframes in json format.
You need to put the dataframes into some sort of structure that can then be serialized back to json. One way would be:
This will avoid having a double-serialized string.