How can I remove white space in the following code block and store in a javascript variable?
This is original format
{ "info":"First Json",
"description":"Official Website",
"timestamp":"1337936081",
"rates":{
"USD":"840",
"CHF":"1319",
"BDT":"298",
}
}
This is the format I want
{"info":"Central Bank of Myanmar","description":"Official Website of Central Bank of Myanmar","timestamp":"1337936081","rates":{"USD":"840","CHF":"1319","BDT":"298","SGD":"632","JPY":"1053","GBP":"887","AUD":"759"}}
var jsonWithWhitespaceRemoved = JSON.stringify(JSON.parse(variableWithJsonWhitespace))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With