I used the Google Gson API to construct JSON. When I initialized a JsonObject with:
JsonObject json = new JsonObject();
and print it out, it was in fact {}
.
I tried to exclude the "empty" JSON, i.e. the {}
ones that were not added any properties. But I could not find a method resembling isEmpty()
in the Gson API.
How can I find out the "empty" JSON with Gson API?