Nested dictionaries

27 views
Skip to first unread message

David Elphee

unread,
Jun 29, 2019, 9:47:38 PM6/29/19
to django...@googlegroups.com
Hello,
I am new at django and in over my head I think.  I am trying to create a kind of shim that will accept JSON from a webhook POST, work with the data using Python, and then POST some new JSON to another API.  I have successfully worked through tutorials that have "flat" data, and I have looked at the documentation on serializing nested data, but I don't see how to write the models to work with the serializers.  Does anyone know of a tutorial that demonstrates working with nested dictionaries?
Thank you,
Dave E.

Joe Reitman

unread,
Jun 30, 2019, 9:06:17 AM6/30/19
to Django users
You want to save JSON data to a database?
Message has been deleted
Message has been deleted

David Elphee

unread,
Jun 30, 2019, 10:26:04 AM6/30/19
to Django users
I guess I don’t even need Django or models to do what I described. But yes, for future functionality, I’d like to be able to store JSON to a database.

Joe Reitman

unread,
Jun 30, 2019, 12:56:56 PM6/30/19
to Django users
I use the JSON module to encode and decode JSON. 

Derek

unread,
Jul 2, 2019, 2:51:25 AM7/2/19
to Django users
I am not sure I understand what you mean by " write the models to work with the serializers".  A model is there primarily for data storage and its possible to store JSON in a field of such a model.  Any "business logic" for the model is just Python and can carry out, for example, processing operations on the JSON data.

For more on JSON operations and JSON fields with databases, have a look at:


for some useful examples.

P.S. If you are working with current versions of Python and Django, you should not yet be in the position to need any shim.
Reply all
Reply to author
Forward
0 new messages