2017-10-24 5 views
-1

Wie konvertiert man JSON stringify in das json Format.? Mein Code: var socket = io.connect ('URL'); socket.on ('trades', Funktion (tradeMsg)) { // console.log (tradeMsg); document.getElementById ('Handel'). InnerHTML = JSON.stringify (HandelMsg) }).Wie konvertiert man JSON stringify in json?

**i required output json format** : ex: 
{ 
    "coin": "SPHR", 
    "exchange_id": "bittrex", 
    "market_id": "BTC_SPHR", 
    "message": { 
     "coin": "SPHR", 
     "msg": { 
     "cap24hrChange": -12.71, 
     "long": "Sphere", 
     "mktcap": 6821313, 
     "perc": -12.71, 
     "price": 2.8884325, 
     "shapeshift": false, 
     "short": "SPHR", 
     "supply": 3082940, 
     "usdVolume": 2838.85, 
     "volume": 2838.85, 
     "vwapData": 2.2126, 
     "vwapDataBTC": 2.2126 
     } 
    }, 
    "msg": { 
     "cap24hrChange": -12.71, 
     "long": "Sphere", 
     "mktcap": 6821313, 
     "perc": -12.71, 
     "price": 2.8884325, 
     "shapeshift": false, 
     "short": "SPHR", 
     "supply": 3082940, 
     "usdVolume": 2838.85, 
     "volume": 2838.85, 
     "vwapData": 2.2126, 
     "vwapDataBTC": 2.2126 
    }, 
    "trade": { 
     "data": { 
     "exchange_id": "bittrex", 
     "market_id": "BTC_SPHR", 
     "price": 2040.8163, 
     "raw": { 
      "Id": 6508626, 
      "TimeStamp": "2017-10-24T08:48:51.533", 
      "Quantity": 9.252431, 
      "Price": 4.9E-4, 
      "Total": 0.00453369, 
      "FillType": "FILL", 
      "OrderType": "SELL" 
     }, 
     "timestamp_ms": 1508834952474, 
     "volume": 0.004533691 
     } 
    } 
} 
+0

Check Link es Ihnen helfen https://stackoverflow.com/questions/11171746/reverse-of-json-stringify –

Antwort

1

hier gehen Sie zuerst müssen Sie JSON-String analysieren. zum Beispiel

var object = JSON.parse("string"); 

jetzt Objekt enthält Ihr erforderliches JSON-Objekt