Wednesday, 31 May 2017

Split object in Node.js

Yesterday i solve my problem spliting my string with "\" but today i have the same problem but with a object...

2|wscontro | [2017-05-31 15:57:23.145] - debug: /opt/wscontroller/wscontroller-api/routes/ubus UbusController 63320169-611e-43f5-880e-9b1a13152cfd getDeviceServicesById signature {"config":"wireless","section":"radio0","values":"{\"disabled\":0"}
2|wscontro | [2017-05-31 15:57:23.145] - debug: /opt/wscontroller/wscontroller-api/routes/ubus UbusController 63320169-611e-43f5-880e-9b1a13152cfd getDeviceServicesById signature "object"

I need to have only signature => {"config":"wireless","section":"radio0","values":"{"disabled":0"}

Can anyone help me? I try to convert to String this object and split doing

var aux = signature.split('\\').join('');
var jsonObject = JSON.parse(aux);

But i get the same result {"config":"wireless","section":"radio0","values":"{\"disabled\":0"}

My last post: Split string by "\" Node.js

anyone can help?



via Catia Matos

No comments:

Post a Comment