aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/serializers.md
diff options
context:
space:
mode:
authorTom Christie2013-05-05 08:51:52 -0700
committerTom Christie2013-05-05 08:51:52 -0700
commit287ff43cdd85a5c2275205bf37e19dea3f69ad01 (patch)
treefbebe8abad45c92f9dc0d3bb87b1d1ecbbdeeb61 /docs/api-guide/serializers.md
parent198b679e02954ebcfac37e9d0146caf575df4f5a (diff)
parent8cabae22c5330da2e0a15a6d61ef038a6447756a (diff)
downloaddjango-rest-framework-287ff43cdd85a5c2275205bf37e19dea3f69ad01.tar.bz2
Merge pull request #805 from vshih/master
Example and spelling fixes.
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 2797b5f5..98c6fbba 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.