I have next code:
import json
string = b'{"campaign_id":6,"email":"[email protected]","time":"2024-01-26T06:05:59.852155Z","message":"Submitted Data","details":"{\"payload\":{\"__RequestVerificationToken\":[\"CfDJ8EfyW-fedawawdawdwadwadwawadawd-6xqg_ZIdEJBpbAHkDQdNM\"],\"__original_url\":[\"https://test-test-test.ru/\"],\"password\":[\"test\"],\"qwe\":[\"Gg4gTWg\"],\"username\":[\"test\"]},\"browser\":{\"address\":\"1.1.1.1\",\"user-agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0\"}}"}'
a = json.loads(string)
Problem is not parsing dict by key details.
If you make json.loads, you will see that in key value the inside json cannot be parsed.
How can i parse dict in key "details".
I tried some another librirais. But no success.
2
Answers
The "details" value appears to be JSON – a string encoding of the dictionary you want. When the outer dict is also encoded, its just a normal string as far as the encoder is concern. You can unwrap by reversing the steps: Decode the outer dict, then decode the inner.
The "details" key contains a string representation of a JSON object, which is escaped.
To parse the nested JSON inside the "details" key,
Try like this