Skip to content

Added recursive constructor option to allow for reviver functions #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 31, 2015

Conversation

stevenroose
Copy link
Collaborator

I accidentally made this PR from my master branch, so I made an additional commit from it. However, both changed are very minor and do not break anything.

First: the field _jsonString holds the stringified version of the object, but it is never used. The toString() method uses the JsonEncoder. So I deleted this field.

Second: JsonDecoder allows for the use of a reviver-method. This way, people can convert json objects to their own classes. The fact that JsonObject always recursively converts all underlying data to JsonObjects, breaks reviver functionality. So I added an optional bool recursive parameter to JsonObject.fromMap to allow for the usage of revivers along with JsonObject. I use it myself and it works just fine.

This parameters allows for opting out of recursive parsing of the JsonObject value. Default behaviour is not changed.
@stevenroose stevenroose changed the title Removed redundant _jsonString to reduce memory usage. Removed redundant _jsonString and added recursive parameter Oct 28, 2014
@stevenroose stevenroose changed the title Removed redundant _jsonString and added recursive parameter Added recursive constructor option to allow for reviver functions Oct 28, 2014
stevenroose added a commit that referenced this pull request Mar 31, 2015
Merge PR: Added recursive constructor option to allow for reviver functions
@stevenroose stevenroose merged commit 09c3c64 into chrisbu:master Mar 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant