Skip to content

Commit

Permalink
Improved heuristic to favor an empty json object in case of an empty map
Browse files Browse the repository at this point in the history
  • Loading branch information
DavyLandman committed Apr 25, 2024
1 parent 332e154 commit 188f4b0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,11 @@ public Void visitInteger(IInteger o) throws IOException {

@Override
public Void visitMap(IMap o) throws IOException {
if (o.getKeyType().isString()) {
if (o.isEmpty()) {
out.beginObject();
out.endObject();
}
else if (o.getKeyType().isString()) {
out.beginObject();
for (IValue key : o) {
out.name(((IString) key).getValue());
Expand Down

0 comments on commit 188f4b0

Please sign in to comment.