I'm trying to add quotes for string values only in a file, for example:
String content = "ids:[\"123\"],name:null,Quantity:8d-1,number:123,name:\"hello\",id2:\"1234\"";
for ids, since it's an array, so it's fine. name is null so it's also good. Quantity needs quotes on its value, number is good as its value is digit. So the expected output is
"ids:[\"123\"],name:null,Quantity:"8d-1",number:123,name:\"hello\",id2:\"1234\"";
I wrote
content.replaceAll(":([^\"]+),", ":\"$1\",");
but which does not give me correct result. Any help is appreciated! Thanks