Skip to content

Pretty formatting puts commas inside empty arrays or objects #26

Closed
@jkeljo

Description

@jkeljo

The stock json module doesn't do this. Repro:

% python3.7 
Python 3.7.0 (default, Oct  2 2018, 09:20:07) 
[Clang 10.0.0 (clang-1000.11.45.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> import json5
>>> json.dumps([], indent=2)
'[]'
>>> json5.dumps([], indent=2)
'[\n  ,\n]'
>>> json.dumps({}, indent=2)
'{}'
>>> json5.dumps({}, indent=2)
'{\n  ,\n}'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions