c0 = Comment.objects.all()[0]
sr = CommentSerializer(instance=c0)
sr.data
➝ 직렬화type(sr.data)
: dictJSONRenderer().render(data0)
json0 = JSONRenderer().render(data0)
JSONParser().parse(BytesIO(json0))
dsr = CommentSerializer(data=ddata0)
dsr.is_valid()
dsr.validated_data
instance = Comment(**dsr.validated_data)
instance.save()
/ | HttpMethod | 과정 |
---|---|---|
serialize | GET(READ) | instance → dict → bytes |
deserialize | PATCH/UPDATE(WRITE) | bytes → dict → is_valid() → instance |