Exporting and importing list with sublist to json

I was trying to export the list with sublist to json. I have failed to export the sublist. Can anyone help me with this.

Thanks in advance
Happy coding :slightly_smiling_face:

My list is similar to this one

IDa06

i need a json file like this:

{
“version”: [
3,
0
],
“0”: {
“addedTime”: “16/02/2021 05:15”,
“content”: “test”,
“done”: 0,
“subtasks”:[ {
“subtaskname”: “subtask1”,
“status”: 1,
“subtaskindex”: 0
}]

},
"1": {
    "addedTime": "16/02/2021 15:15",
    "content": "test1",
    "done": 1,
    "subtasks":[ {
        "subtaskname": "subtask1",
        "status": 1,
        "subtaskindex": 0
    },
     {
        "subtaskname": "subtask2",
        "status": 0,
        "subtaskindex": 1
    }]
}

}

but i am getting only second subtask

{
“version”: [
3,
0
],
“0”: {
“addedTime”: “18/02/2021 10:41”,
“content”: “test1”,
“done”: 0,
“subtasks”: {
“Subtask”: “Subtask1”
},
“subtaskindex”: 0
},
“1”: {
“addedTime”: “18/02/2021 10:41”,
“content”: “test2”,
“done”: 0,
“subtasks”: {
“Subtask”: “Subtask2”
},
“subtaskindex”: 1
}
}

here task2 have 2 subtask and ony getting the second one.
is there anyone can help me with this.

It would be good if you share some demo code

currently i have no time. need to put some to get the code ready.thanks for the reply i will try as soon as possible to add the code. thank you