quinnj / JSON3.jl

Other
214 stars 47 forks source link

Closing bracket misaligned for empty dicts when calling JSON3.pretty #225

Closed arnaudh closed 2 years ago

arnaudh commented 2 years ago

The closing bracket for the inner dict is confusingly aligned with the whole object's starting bracket:

julia> JSON3.@pretty Dict("a" => 1, "b" => Dict())
{
   "b": {
},
   "a": 1
}

Note if the dict is non-empty, this is not an issue and the bracket aligns with the inner dict's opening bracket:

julia> JSON3.@pretty Dict("a" => 1, "b" => Dict("c" => 2))
{
   "b": {
           "c": 2
        },
   "a": 1
}