aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/serializers.md
diff options
context:
space:
mode:
authorTom Christie2013-05-05 18:12:35 +0100
committerTom Christie2013-05-05 18:12:35 +0100
commitb70c9cc107743b45edc50c4b4e5e6a7d5a856f01 (patch)
tree2949ff7eda5c81aff8fdfd4d97a7cef8ad55f1c3 /docs/api-guide/serializers.md
parent75b2afcb23d0968d4c7115243cdfaa778da5dca4 (diff)
parent287ff43cdd85a5c2275205bf37e19dea3f69ad01 (diff)
downloaddjango-rest-framework-b70c9cc107743b45edc50c4b4e5e6a7d5a856f01.tar.bz2
Merge master
Diffstat (limited to 'docs/api-guide/serializers.md')
-rw-r--r--[-rwxr-xr-x]docs/api-guide/serializers.md5
1 files changed, 3 insertions, 2 deletions
diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md
index 4d63fc0a..c83a0967 100755..100644
--- a/docs/api-guide/serializers.md
+++ b/docs/api-guide/serializers.md
@@ -59,14 +59,15 @@ We can now use `CommentSerializer` to serialize a comment, or list of comments.
At this point we've translated the model instance into python native datatypes. To finalise the serialization process we render the data into `json`.
- stream = JSONRenderer().render(data)
- stream
+ json = JSONRenderer().render(serializer.data)
+ json
# '{"email": "leila@example.com", "content": "foo bar", "created": "2012-08-22T16:20:09.822"}'
## Deserializing objects
Deserialization is similar. First we parse a stream into python native datatypes...
+ stream = StringIO(json)
data = JSONParser().parse(stream)
...then we restore those native datatypes into a fully populated object instance.