Hey there! Currently, I'm working on tidying up a JSON string. Let me show you an example of what I have:
" .tagline-wrapper ":{
" padding-top":"398px",
" font-size":" 1.8rem",
" "
},
".tagline ":{
" padding-top":"398px",
" font-size":" 1.8rem",
" ",
},
".wrapper":{
" padding-top":"398px",
" font-size":" 1.8rem",
"",
},
My goal is to eliminate the double quotes that are either empty or contain white space (which can include multiple spaces). I've attempted to get rid of consecutive white spaces and then replace quotes like this:
str = str.replace("\" ","");
str = str.replace("\"\"","");
However, these methods haven't been successful. I also need to remove the commas. If possible, I'd like to eliminate consecutive commas while disregarding any white space. If you could assist with that too, it would be greatly appreciated. The desired output should look like this:
" .tagline-wrapper":{
" padding-top":"398px",
" font-size":" 1.8rem",
},
".tagline":{
" padding-top":"398px",
"font-size":" 1.8rem",
},
".wrapper":{
" padding-top":"398px",
" font-size":" 1.8rem",
},
This way, I'll be able to parse the JSON smoothly.