Joke Collection Website - Public benefit messages - How to traverse all the keys of a json object in JS and get the value based on the dynamic key

How to traverse all the keys of a json object in JS and get the value based on the dynamic key

For a json object, how to traverse all the keys of the json object. When using the json object, if you cannot know the key, please refer to the following key code:

p>

Json object:

 

var smsTypeDesc = {"4":"Return visit SMS","3":"Email SMS","aa":"Test SMS "};

Through the above code, you can see It's very simple. According to the dynamic key, it is mainly accessed through []. For those who know the key, access is through.