Index value of Array

前端 未结 7 1601
眼角桃花
眼角桃花 2021-01-12 08:56

I have a json file with contents like this:

{
     \"aaa\":{
         \"status\":\"available\",
         \"classkey\":\"dotnet\"
     },
     \"bbb\":{
              


        
7条回答
  •  隐瞒了意图╮
    2021-01-12 09:27

    Actually you can use int index like an array in JSON, just try that:

    var jsonObject = {
         "0":{
             "status":"available",
             "classkey":"dotnet"
         },
         "1":{
             "ccc":{
                 "com":"available",
                 "net":"available",
                 "info":"available",
                 "org":"available"
              }
         }
    }
    
    alert(jsonObject[0].status)
    

提交回复
热议问题