Skip to content

Response data cannot be serialized back to JSON #15

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
Jun 17, 2013

Conversation

joncotton
Copy link
Contributor

Custom classes don't serialize well and AttrDict is no exception. The Url model built from JSON cannot be serialized back to JSON. This is a symptom of reimplementing a core language data structure.

BREAKS BACKWARD COMPATIBILITY

This PR introduces a failing test to demonstrate the problem. AttrDict is replaced with a native Python dictionary and this breaks backward compatibility - namely dictionaries should behave like dictionaries and so a) Url no longer has attribute access to the data members and b) nested dictionaries aren't coerced into AttrDict.

joncotton added 3 commits May 16, 2013 16:57
…structure. Furthermore, the custom AttrDict doesn't JSON serialize so an object built from JSON cannot be serialized back to JSON.

**BREAKS BACKWARD COMPATIBILITY.** This is now a real Python dictionary and *no longer has attribute access* for the data. This could be added back, but it's un-pythonic and introduces complexity. UserDict retains the ability to access `data`. The `dict` property is gone.
@screeley screeley merged commit 1127f06 into embedly:master Jun 17, 2013
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.

2 participants