Skip to content
This repository has been archived by the owner. It is now read-only.

Encoding json #577

merged 5 commits into from Jun 21, 2017

Encoding json #577

merged 5 commits into from Jun 21, 2017


Copy link

@abonie abonie commented Jun 20, 2017

Native implementation of parts of json module: json.dump, json.dumps and json.JSONEncoder.

For the time being iterencode method of JSONEncoder returns a length 1 list instead of a generator.
JSONEncoder should be a class but instead is a factory function returning JSONEncoder objects. That is because there is currently no way to pass keyword arguments to object constructors implemented in JavaScript.

abonie added 5 commits Jun 20, 2017
basic implementation of JSONEncoder - does not accept arguments on init
basic implementation of encode - needs to be properly tested, there is
some sort of bug while encoding booleans, no circular structure checking
or error handing in general
some simple tests - would be great to reduce boilerplate somehow
In order to allow JSONEncoder to accept keyword arguments there is now a
dummy JSONEncoder function (not an actual ctor) that creates instances
of JSONEncoder (like a factory). Most of arguments functionality is
still lacking.
Most of the keyword arguments to JSONEncoder has been implemented. Still
missing sort_keys, check_circular and ensure_ascii.
Refactor tests and module structure

Implement ensure_ascii, check_circular, dump, dumps and iterencode
Copy link

@freakboy3742 freakboy3742 left a comment


@freakboy3742 freakboy3742 merged commit bbeefbf into beeware:master Jun 21, 2017
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants