Uzee Uzee - 29 days ago 15
JSON Question

How to access json data in jquery?

var newOptions = {
"Option 1": "value1",
"Option_2": ["value2","v1","v2","v3"],
"Option 3": "value3"
};


I am new in jquery and json, And I don't know how to access or parse the data

Here in Option_2 there are multiple values and I want to split it and make a new dropdown menu which has values of Option 2
and When i select option 3 other dropdown changes its options according to these keys.

PS: I have searched so many sites and Googled it hundreds of times but cant find the answer that is why I am asking this question.

I get reference from this Site https://css-tricks.com/dynamic-dropdowns/
and trying to make Dynamic dropdown using Json

Answer

You can try like this

$.each(newOptions.Option_2, function (index, elem) {
           alert(elem);
        });