How to extract map from json string?

时间:2022-01-11 16:04:43

I have this json:SBHJm ,./tf,dj kmlhsZdsbnmifgkldsf;kbnrfposfj mfgiofsmkv fgopktmfiosadznjeriosdbnmseroidzjbm iosersj ioz;dknrwfdc iOSRZdfhntfrwaio;dxcmjsterkd0pofg dmfpos mjrsepodhnjsew2gioxhjnmkw2eospjkrepo'd,j-0p]z[tmhjoe[apwtjmdyt,]-9op524RMJNW45OEPNHJM53,94-0WPH5S4RTKL4EJR-903EIK-O0JHYTK2QW]-0MS,UK4Wope0skjdytpof[4r21mwejn9eopwkm5ret-0pyt,k21qom-p[k,tl[]3q,kwqpmjpogtmpol

我有这样的JSON:SBHJm,/ TF,DJ kmlhsZdsbnmifgkldsf; kbnrfposfj mfgiofsmkv fgopktmfiosadznjeriosdbnmseroidzjbm iosersj IOZ; dknrwfdc iOSRZdfhntfrwaio; dxcmjsterkd0pofg dmfpos mjrsepodhnjsew2gioxhjnmkw2eospjkrepo'd,J-0P] Z [tmhjoe [apwtjmdyt,] - 9op524RMJNW45OEPNHJM53,94-0WPH5S4RTKL4EJR-903EIK-O0JHYTK2QW。 ] -0MS,UK4Wope0skjdytpof [4r21mwejn9eopwkm5ret-0pyt,k21qom-p [K,TL [] 3Q,kwqpmjpogtmpol

[
  [
    {
      "hasTouchScreen": true,
      "hasTelephoneCommunication": true,
      "braceletType": "METALLIC",
      "sexType": "MALE",
      "isWaterproof": true,
      "id": 20,
      "cost": 4200.5,
      "modelName": "casmod-2",
      "manufacturer": "rolex",
      "clockFaceGlassType": "GLASS"
    },
    1
  ],
  [
    {
      "hasTouchScreen": true,
      "hasTelephoneCommunication": true,
      "braceletType": "METALLIC",
      "sexType": "MALE",
      "isWaterproof": true,
      "id": 21,
      "cost": 5200.0,
      "modelName": "casmod-3",
      "manufacturer": "rolex",
      "clockFaceGlassType": "GLASS"
    },
    1
  ],
  [
    {
      "hasTouchScreen": true,
      "hasTelephoneCommunication": true,
      "braceletType": "METALLIC",
      "sexType": "MALE",
      "isWaterproof": true,
      "id": 22,
      "cost": 300.0,
      "modelName": "casmod-4",
      "manufacturer": "rolex",
      "clockFaceGlassType": "GLASS"
    },
    2
  ]
]

How I can get and iterate Map in JQuery? Map is serialized via Gson in java.

我如何在JQuery中获取和迭代Map?地图在java中通过Gson序列化。

1 个解决方案

#1


0  

for (let index in map) {...}

OR in jQuery

或者在jQuery中

$.each(map, function(index, element) {...});

$.each API docs

$ .each API文档

#1


0  

for (let index in map) {...}

OR in jQuery

或者在jQuery中

$.each(map, function(index, element) {...});

$.each API docs

$ .each API文档