Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

Encoding json #577

Merged
merged 5 commits into from
Jun 21, 2017
Merged

Encoding json #577

merged 5 commits into from
Jun 21, 2017

Conversation

abonie
Copy link
Contributor

@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.

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
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

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

Successfully merging this pull request may close these issues.

2 participants