Query Data items -

So basically this is what I want to achieve.

I have a Data file called countries.json. This json file lists all Countries.
I have a second Data file called state.json. This represents states based on Countries selected.

I want to achieve this.

Instance 1

  • If a user click US as a dropdown value, I want to be able to generate all the States.

How do you get an output of locations on this example

Data - countries.json
[
{“location” : “USA”}.
{“location” : “South Africa”}
]

How do I get USA as a value and using that to create some sort of if statement?

Here are some basic examples:
https://gohugo.io/templates/data-templates/

It seems like you want to create an HTML form with a dependent dropdown, which is “off topic” for this forum. You might start by searching Stack Overflow.