# How to load json data dynamically in external\_choices

**URL:** <https://forum.getodk.org/t/how-to-load-json-data-dynamically-in-external-choices/28206>\
**Category:** Support\
**Tags:** odk-aggregate, odk-xforms, odk-xlsform, enketo\
**Created:** [July 11, 2020, 2:59pm UTC](https://forum.getodk.org/t/how-to-load-json-data-dynamically-in-external-choices/28206 "2020-07-11T14:59:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashish\_Mishra](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ashish_mishra/32/12175_2.png) [@Ashish\_Mishra](https://forum.getodk.org/u/Ashish_Mishra)\
**Post date:** [July 11, 2020, 2:59pm UTC](https://forum.getodk.org/t/how-to-load-json-data-dynamically-in-external-choices/28206/1 "2020-07-11T14:59:57Z")

</div>

Hello, community. I am new in ODK forms. I just want to ask how can I load JSON data in my external\_choices at run time dynamically.  
Example: I want to load data based on district\_id. In my one district, there are 2000 villages, and I have 40 districts in my state. Feeding 40\*2000=80000 villages in external\_choices and loading it at run time is very ram consuming. So in my case, I'll just want to pass the district\_id in my query parameter and villages belonging to that district will be fetched from JSON and loaded into external\_choices. Can anybody help how I can achieve it?

---

<div class="post-metadata">

**Author:** ![Grzesiek2010](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/grzesiek2010/32/2881_2.png) [@Grzesiek2010](https://forum.getodk.org/u/Grzesiek2010)\
**Post date:** [July 11, 2020, 11:52pm UTC](https://forum.getodk.org/t/how-to-load-json-data-dynamically-in-external-choices/28206/2 "2020-07-11T23:52:22Z")

</div>

Hi @Ashish_Mishra  
welcome to the forum! Please [introduce yourself here!](https://forum.getodk.org/t/introduce-yourself-here/6671)

Answering your question: it's not possible to load json data. You need to convert into it to csv and then filter using your ID and search [function](https://xlsform.org/en/#dynamic-selects-from-pre-loaded-data)

---

<div class="post-metadata">

**Author:** ![Ashish\_Mishra](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ashish_mishra/32/12175_2.png) [@Ashish\_Mishra](https://forum.getodk.org/u/Ashish_Mishra)\
**Post date:** [July 12, 2020, 11:47am UTC](https://forum.getodk.org/t/how-to-load-json-data-dynamically-in-external-choices/28206/3 "2020-07-12T11:47:26Z")

</div>

@Grzesiek2010 thank you for your response. Do you have any examples of it? Because I am new into it so not able to understand it. Thank you

---

<div class="post-metadata">

**Author:** ![Grzesiek2010](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/grzesiek2010/32/2881_2.png) [@Grzesiek2010](https://forum.getodk.org/u/Grzesiek2010)\
**Post date:** [July 12, 2020, 6:39pm UTC](https://forum.getodk.org/t/how-to-load-json-data-dynamically-in-external-choices/28206/4 "2020-07-12T18:39:37Z")

</div>

Maybe I have something but I'm being on vacation now writing this from my phone so can't check but if you don't understand in you can watch this video [https://youtu.be/eEXa8GK4yE4](https://youtu.be/eEXa8GK4yE4)  
Or browse this forum, I'm sure there are some similar topics here.

---

<div class="post-metadata">

**Author:** ![dicksonsamwel](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/dicksonsamwel/32/2898_2.png) [@dicksonsamwel](https://forum.getodk.org/u/dicksonsamwel)\
**Post date:** [July 14, 2020, 4:57am UTC](https://forum.getodk.org/t/how-to-load-json-data-dynamically-in-external-choices/28206/5 "2020-07-14T04:57:27Z")

</div>

Hi @Ashish_Mishra,

There are many threads that can help you with this. You can start by checking out this

> [@How to make it easier to select an item in a very long list of choices inside a select\_one\_external in a repeat in ODK collect](https://forum.getodk.org/t/how-to-make-it-easier-to-select-an-item-in-a-very-long-list-of-choices-inside-a-select-one-external-in-a-repeat-in-odk-collect/26856):
>
> 1. What is the problem? Be very detailed. Inside a repeat, I have a select\_one\_external of species names. It cannot be avoided that this list contains more than a thousand items. In Enketo, this is no problem because autocomplete works. In ODK app, the users are forced to scroll the entire list especially when the species names start with letters S or T, for example. This problem is made more difficult because the repeat loop typically contains at least 5 repetitions, sometimes it my have more…

Also this

> [@Hide select one external on repeat](https://forum.getodk.org/t/hide-select-one-external-on-repeat/11999):
>
> What is the problem? Please be detailed. I have a select one based on an external csv. For example. when you enter a room number "T0001", It looks through the csv and pullout a list of T0001/1, T0001/2 and T0001/3 which are also select one. I want when the user select T0001/1 and answer the question under that and next it repeats the list T0001/1, T0001/2 and T0001/3. When the repeat happens it should hide T0001/1 since it has already been answered. What ODK tool and version are you using? And…
