I would like to remove double-quotes from keys of JSONObjects (JSON.Simple) when converting the object to a String.
For example, I have the following JSONObject:
JSONObject object = new JSONObject();
object.put("foo", "bar");
System.out.println(object.toJSONString());
Which outputs:
{"foo":"bar"}
And I would like to remove the double quotes from the key object, foo
:
{foo:"bar"}
Although this would not become valid JSON, how can I accomplish this? Should I be using regex for this case?