I am new to JSON. I have a JSON list in a tree structure like below:
{
"complaint@simulator.amazonses.com": {
"time": "2018-01-02T20:45:46.65Z",
"type": "Complaint",
"bounceType": "null",
"bounceSubType": "null"
},
"struax@example.org": {
"time": "2018-01-02T20:53:03Z",
"type": "Bounce",
"bounceType": "Permanent",
"bounceSubType": "Suppressed"
},
"bounce-test@service.socketlabs.com": {
"time": "2018-01-02T21:06:40.097Z",
"type": "Bounce",
"bounceType": "Permanent",
"bounceSubType": "Suppressed"
},
"bounce@simulator.amazonses.com": {
"time": "2018-01-02T21:08:02Z",
"type": "Bounce",
"bounceType": "Permanent",
"bounceSubType": "General"
},
"jstrechay@example.org": {
"time": "2018-01-05T06:31:39Z",
"type": "Bounce",
"bounceType": "Permanent",
"bounceSubType": "General"
},
"leematt45@example.org": {
"time": "2018-01-05T06:49:13Z",
"type": "Bounce",
"bounceType": "Permanent",
"bounceSubType": "Suppressed"
},
"afbweb@example.org": {
"time": "2018-01-07T12:50:38Z",
"type": "Bounce",
"bounceType": "Transient",
"bounceSubType": "General"
},
"bajanina2013@example.org": {
"time": "2018-01-02T08:12:19Z",
"type": "Bounce",
"bounceType": "Transient",
"bounceSubType": "MailboxFull"
},
"martin.bunt@example.org": {
"time": "2018-01-05T07:00:24Z",
"type": "Complaint",
"bounceType": "null",
"bounceSubType": "null"
}
}
My SQL table columns are Email
, time
, type
, bounceType
, and bounceSubType
.
How can I extract data from the JSON list and save it in the DB?
I am using this code:
string JSON = response.Content.ReadAsStringAsync().Result;
var jObj = (JObject)JsonConvert.DeserializeObject(JSON);
The JSON is in a tree structure and I am not able to fetch the parent node and the respective child in a list.