如何将 JSON stringify 转换为 JSON?
如何将 JSON stringify 转换为 JSON?
如何将JSON stringify转换为JSON格式?\n我的代码:\nvar socket = io.connect(\'URL\');\nsocket.on(\'trades\', function (tradeMsg) {\n // console.log(tradeMsg);\n document.getElementById(\'trade\').innerHTML = JSON.stringify(tradeMsg)\n}).\n**我需要的输出JSON格式**:例如:\n{\n \"coin\": \"SPHR\",\n \"exchange_id\": \"bittrex\",\n \"market_id\": \"BTC_SPHR\",\n \"message\": {\n \"coin\": \"SPHR\",\n \"msg\": {\n \"cap24hrChange\": -12.71,\n \"long\": \"Sphere\",\n \"mktcap\": 6821313,\n \"perc\": -12.71,\n \"price\": 2.8884325,\n \"shapeshift\": false,\n \"short\": \"SPHR\",\n \"supply\": 3082940,\n \"usdVolume\": 2838.85,\n \"volume\": 2838.85,\n \"vwapData\": 2.2126,\n \"vwapDataBTC\": 2.2126\n }\n },\n \"msg\": {\n \"cap24hrChange\": -12.71,\n \"long\": \"Sphere\",\n \"mktcap\": 6821313,\n \"perc\": -12.71,\n \"price\": 2.8884325,\n \"shapeshift\": false,\n \"short\": \"SPHR\",\n \"supply\": 3082940,\n \"usdVolume\": 2838.85,\n \"volume\": 2838.85,\n \"vwapData\": 2.2126,\n \"vwapDataBTC\": 2.2126\n },\n \"trade\": {\n \"data\": {\n \"exchange_id\": \"bittrex\",\n \"market_id\": \"BTC_SPHR\",\n \"price\": 2040.8163,\n \"raw\": {\n \"Id\": 6508626,\n \"TimeStamp\": \"2017-10-24T08:48:51.533\",\n \"Quantity\": 9.252431,\n \"Price\": 4.9E-4,\n \"Total\": 0.00453369,\n \"FillType\": \"FILL\",\n \"OrderType\": \"SELL\"\n },\n \"timestamp_ms\": 1508834952474,\n \"volume\": 0.004533691\n }\n }\n}\n