How to count JSON objects

前端 未结 6 428
北海茫月
北海茫月 2020-12-15 09:42

Here is my JSON:

[
    {
        \"id\": \"38\",
        \"article_id\": \"16\",
        \"news_event\": \"625\",
        \"language\": \"en\",
        \"cha         


        
6条回答
  •  半阙折子戏
    2020-12-15 10:32

    You can use the following solution to count JSON objects:

    var jsonObject = {"test1":1,"test2":2};
    var keyCount  = Object.keys(jsonObject).length;
    

提交回复
热议问题