How to Remove Square bracket from JSON

后端 未结 3 963
甜味超标
甜味超标 2020-12-10 16:01

I have one json string like below

[

    {
        \"Name\": \"TEST\",
        \"deviceId\": \"\",
        \"CartId\": \"\",
        \"timestamp\": 138319726         


        
3条回答
  •  死守一世寂寞
    2020-12-10 16:11

    var tmpStr = '[    
        {
            "Name": "TEST",
            "deviceId": "",
            "CartId": "",
            "timestamp": 1383197265540,
            "FOOD": [],
            "City": "LONDON CA"
         }
    
    ]';
    
    var newStr = tmpStr.substring(1, tmpStr.length-1);
    

    See this codepen example

提交回复
热议问题