Python JSON Serialization/Deserialization Made Easy!

preview_player
Показать описание
Here's a little tutorial on how I parse JSON into Python data classes using the json module. Data classes are super nice because there's a lot less ceremony with setting them up. They're straight the point when all you need is a model for some data structure. I thought using steam's api as a real world example would be helpful for bridging the gap between a real world scenario and a made up one. Hopefully you can find good use cases in your projects!

#python #pythonforbeginners #coding #programming #data #class
Рекомендации по теме
Комментарии
Автор

I've been doing it the extremely hard way. You just opened up a whole new way of working for me! Thank you so much for this making this.

thepackbot
Автор

I think you mixed up serialisation and deserialisation. To serialise is to put a memory object into a series of characters, i.e. a json string. Deserialising is to take a serialised object representation such as json and constructing a memory representation of it that is not serial due to pointers, metadata, etc.

Great video! Really nice sharing your methods and insights to make daily life with python code easier. Thanks!!

wvlpndc
Автор

Serialization would be converting the data class into the byte stream (json object). Deserialization taking that and putting it back into memory as an data class object.

You reversed the two.

Other than that, this was very very clear and easy to understand. Serialization can be confusing but it really is this simple.

steveyuhas
Автор

Very good video!
But, please, think in phone viewers (small screen).

airtonco
Автор

as others mentioned, you swapped the deserialization and serialization definitions, but otherwise great video! Thanks!

andrewvalenski
Автор

object in memory -> json = serialization
json -> object in memory = deserialization
you messed this up

tryfonmichalopoulos
Автор

There are some naming conventions in python. If you do educational videos, you should respect them. PEP8

hansdietrich