Convert string to json datatype before send back JSON API to client in Django Rest Framework

Clash Royale CLAN TAG#URR8PPP
Convert string to json datatype before send back JSON API to client in Django Rest Framework
I have json structure data stored into sqlite as string.(Because sqlite does not support data type json) Thus, when JSON API request come, this json structure data is returned as string as shown below image. However, I want to convert string to json at server side and send to client as json data type. Does anyone know how I can implement?
1 Answer
1
You could use serializers.JSONField
serializers.JSONField
class MyserializerClass(serializers.Serializer):
# your code
json = serializers.JSONField()
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Possible duplicate of Django REST framework: create JSON fragments from string
– JackNavaRow
Aug 9 at 11:58