Python Forum
How to serialize custom class objects in JSON?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to serialize custom class objects in JSON?
#3
In essence, it just boils down to making a JSON object where the keys are the field names (and so the values are, well, the field values). If you can make a dictionary in that form, you can just use json.dumps to produce a string containing the JSON representation.
Reply


Messages In This Thread
RE: How to serialize custom class objects in JSON? - by ndc85430 - Sep-22-2019, 06:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I access objects or widgets from one class in another class? Konstantin23 3 1,087 Aug-05-2023, 08:13 PM
Last Post: Konstantin23
Question How to move a class to a custom module? python300 4 1,621 Mar-08-2022, 09:19 PM
Last Post: python300
  Custom file class deanhystad 11 4,540 Feb-01-2021, 05:09 PM
Last Post: nilamo
  Class objects Python_User 12 4,561 Aug-27-2020, 08:02 PM
Last Post: Python_User
  How to create and define in one line a 2D list of class objects in Python T2ioTD 1 2,087 Aug-14-2020, 12:37 PM
Last Post: Yoriz
  printing class properties from numpy.ndarrays of objects pjfarley3 2 1,992 Jun-08-2020, 05:30 AM
Last Post: pjfarley3
  Parse JSON multiple objects larkin_L 8 5,895 May-27-2020, 11:18 AM
Last Post: nuffink
  Help with lists and class objects AlluminumFoil 15 5,645 Jan-15-2020, 07:32 PM
Last Post: AlluminumFoil
  How do I write class objects to a file in binary mode? Exsul1 7 5,869 Sep-14-2019, 09:33 PM
Last Post: snippsat
  Do objects get their own copy of the class methods? Charles1 1 2,131 Feb-02-2019, 04:40 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020