# import-export Importing nested json data

**URL:** <https://forum.djangoproject.com/t/import-export-importing-nested-json-data/16613>\
**Category:** Mystery Errors\
**Created:** [October 23, 2022, 6:12pm UTC](https://forum.djangoproject.com/t/import-export-importing-nested-json-data/16613 "2022-10-23T18:12:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![biscotty666](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/biscotty666/32/10522_2.png) [@biscotty666](https://forum.djangoproject.com/u/biscotty666)\
**Post date:** [October 23, 2022, 6:12pm UTC](https://forum.djangoproject.com/t/import-export-importing-nested-json-data/16613/1 "2022-10-23T18:12:03Z")

</div>

Hi,  
I need to import some data from json. The data contains nested objects and I’m unclear how to reference through to that data when writing the resource. I only see documentation about how to access fields at the “root” level of the data structure, not the nested levels. There is a bunch of info on exporting nested structures to json but I haven’t found anything on importing.

```auto
[{
    "somekeys": somevalues,
    "roster": [
      {
        "id": "P2021130273",
        "name": "Benja",
        "level": 85,
      },
      { more records },
    ]
}]

```

My goal is to map to the ids in the “roster” list. Where could I look for this information?

Thanks

PS FWIW I have a routine for importing the data using loops but was interested in trying this method.

---

<div class="post-metadata">

**Author:** ![atcrank](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/atcrank/32/2029_2.png) [@atcrank](https://forum.djangoproject.com/u/atcrank)\
**Post date:** [October 23, 2022, 11:39pm UTC](https://forum.djangoproject.com/t/import-export-importing-nested-json-data/16613/2 "2022-10-23T23:39:08Z")

</div>

The only thing I can think of here would be natural-key framework where you would define a ‘get\_by\_natural\_key’ method on the default manager (“objects”); but the roster entries would need to already exist. +1 on this question, I would like to know more.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [October 24, 2022, 2:56am UTC](https://forum.djangoproject.com/t/import-export-importing-nested-json-data/16613/3 "2022-10-24T02:56:16Z")

</div>

I don’t recall seeing a lot of traffic about django-import-export here. I’m not sure how many people here use it regularly or in great detail.

Technically, this is a 3rd party package and not a part of Django. I don’t see anything listed in their docs for a preferred method of requesting support, but you may get faster and more direct assistance if you start a discussion on their discussions page on github. ([Discussions · django-import-export/django-import-export · GitHub](https://github.com/django-import-export/django-import-export/discussions))

---

<div class="post-metadata">

**Author:** ![biscotty666](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/biscotty666/32/10522_2.png) [@biscotty666](https://forum.djangoproject.com/u/biscotty666)\
**Post date:** [October 24, 2022, 4:57pm UTC](https://forum.djangoproject.com/t/import-export-importing-nested-json-data/16613/4 "2022-10-24T16:57:48Z")

</div>

Thanks. I’ll check into it on their discussions page (thanks for pointing me to it) and let you know if I find a solution.

---

<div class="post-metadata">

**Author:** ![biscotty666](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/biscotty666/32/10522_2.png) [@biscotty666](https://forum.djangoproject.com/u/biscotty666)\
**Post date:** [October 28, 2022, 10:00pm UTC](https://forum.djangoproject.com/t/import-export-importing-nested-json-data/16613/5 "2022-10-28T22:00:36Z")

</div>

Didn’t want to leave this hanging so… I decided that using the import-export module was more trouble than it was worth so I am just looping through the data. The code is clean and easy to read so I’m just leaving it like that.

Thanks
