How can I get the key value in a JSON object?

前端 未结 6 1718
北恋
北恋 2020-12-24 13:30

How do I get the key value in a JSON object and the length of the object using JavaScript?

For example:

[
  {
    "amount": " 12185"         


        
6条回答
  •  清歌不尽
    2020-12-24 14:19

    When you parse the JSON representation, it'll become a JavaScript array of objects.

    Because of this, you can use the .length property of the JavaScript array to see how many elements are contained, and use a for loop to enumerate it.

提交回复
热议问题