Skip to content

Stream ignores custom json.JSONEncoder separators argument #35

@TrevinAvery

Description

@TrevinAvery

When using a custom json.JSONEncoder, the output ignores the separators argument.

Example: Using separators with no spaces to minify file size.

import json, jsonstreams

def encoder(*args, **kwargs): 
    return json.JSONEncoder(separators=(',', ':')) 

with jsonstreams.Stream(jsonstreams.Type.object, 'out.json', encoder=encoder) as s:
    s.write('key', 'value')

Observed out.json

{"key": "value"}

Expected out.json

{"key":"value"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions