Given the following json...
var body = { name: test, description: test json, website: domain.com }
... how do I remove all the white spaces except the ones in the values?
I've tried the following regexp...
var body = { name: test, description: test json, website: domain.com }.replace(/r?n|r/g, ).replace(/s+/g, )
... but it also removes the spaces in the values (i.e. description
):
{name:test,description:testjson,website:domain.com}
I need to obtain
{name:test,description:test json,website:domain.com}
Tx.