'Convert dictionary to Json which Contains key of Json
I have an interesting problem where performance is of absolute importance. I have a dictionary such as:
d = {
'a': object1,
'b': object2,
'c': objectJson
}
return json.dumps(d)
The problem is that entry 'c' is already json, which does not serialize the dictionary correctly. So to solve this problem I can do:
d= {
'a': object1,
'b': object2,
'c': json.loads(objectJson)
}
return json.dumps(d)
But this increases execution time.
What is the easiest way of incorporating existing json inside an object and serialize it with correct output without having to start manipulating strings?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
