I want to remove extra quote from the below Json
{""id"":""1"", ""name"":""john"",""address"":"",""timestamp"":""2018/01/01 12:43:42 -700"",""dept"":""}
I am using the sed
command for this:
sed -i -e 's/""/"/g' file.json
However it's not working as expected because the values for address
and dept
are just the empty string ""
and I don't want to replace those by just a single "
which would be a new JSON syntax error. I want to replace only the doubled double quotes around fields which contain an actual value. So I tried
sed -i -e 's/\""[a-z]+[0-9]+[.-]+\""/"[a-z]+[0-9]+[.-]+\"/g' file.json
but it's not working either.
How can I achieve this?