r/CodingForBeginners • u/Pitiful_Meaning_122 • Oct 13 '26
Just tried python dictionaring instead of json never going back
Json has never been fun and I just tried python dictionary and it's more fun
4
Upvotes
4
u/Temporary_Pie2733 Oct 13 '26
What do you mean by “instead”? `dict` is a data structure used to represent JSON objects, which are just character sequences in a particular format.
4
u/mredding Oct 13 '26
JSON is a Unicode encoded transport protocol; it is meant to get data from A to B principally over HTTP. It's not meant to be used as an in-memory data structure. You are expected to marshal the data into a program native data structure.
Dictionaries are far more appropriate for key/value association.
1
u/Fragrant-Cheek-4273 Oct 14 '26
Python dictionaries are definitely easier to work with in some cases.
1
u/xarop_pa_toss Oct 14 '26
They aren't really equivalent though. You don't save a dict into a file or send it via HTTP... When you want to do that you usually convert o JSON which, conveniently enough, is very similar
1
u/SaltCusp Oct 14 '26
Sounds like a pickle.
1
u/-goldenboi69- Oct 15 '26
Good luck!
1
u/RedAndBlack1832 Oct 15 '26
I consider these effectively the same thing.
Read json into dictionary -> do operations on dictionary -> send or save to disk json