Hello here's related KB for you to understand better :
Dynamic Cascading Drop-Down List
and also an updated sample app with Dynamic cascading based on the JSON API load country names in the KB i mentioned before : JSON API Options.
APP_jsonApiFormOptions-2-20240804064148.jwa
The key to get the cascading to work is the "Grouping Column"
Here it will be group based on code column in JSON API data . Hence > response.code

and "Field Id to control available options based on grouping"
code is the field id for the select box Code where we will select to dynamically display data in the Name based on the selected value in Code

hope it helps!