Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
JSON Dump and JSON Load
#6
Thanks. This is what I was looking for. I think we always hope for a silver bullet cause its so simple to pull data out in a single line of code that you would think it could be brought back in the same way with a single line of code.

I was able to rebuild the object correctly below:

            warMapSerializedData = json.loads(j.read())
            _fxWarMapStatic = fxWarMapStatic(warMapSerializedData["mapName"])
            _fxWarMapStatic.regionId = warMapSerializedData["regionId"]
            _fxWarMapStatic.scorchedVictoryTowns = warMapSerializedData["scorchedVictoryTowns"]
            _fxWarMapStatic.lastUpdated = warMapSerializedData["lastUpdated"]
            _fxWarMapStatic.version = warMapSerializedData["version"]

            fxWarMapStaticMapItems = warMapSerializedData["mapTextItems"]
            for _fxWarMapStaticMapItem in fxWarMapStaticMapItems:
                _fxWarMapStatic.mapTextItems.append(fxWarMapStaticMapItem(_fxWarMapStaticMapItem["text"], _fxWarMapStaticMapItem["x"], _fxWarMapStaticMapItem["y"], _fxWarMapStaticMapItem["mapMarkerType"]))
Reply


Messages In This Thread
JSON Dump and JSON Load - by foxholenoob - Oct-12-2023, 12:27 AM
RE: JSON Dump and JSON Load - by foxholenoob - Oct-12-2023, 12:46 AM
RE: JSON Dump and JSON Load - by deanhystad - Oct-12-2023, 01:59 AM
RE: JSON Dump and JSON Load - by foxholenoob - Oct-12-2023, 04:01 AM
RE: JSON Dump and JSON Load - by deanhystad - Oct-12-2023, 04:25 AM
RE: JSON Dump and JSON Load - by foxholenoob - Oct-12-2023, 05:39 AM
RE: JSON Dump and JSON Load - by deanhystad - Oct-12-2023, 06:03 AM
RE: JSON Dump and JSON Load - by buran - Oct-12-2023, 07:10 AM
RE: JSON Dump and JSON Load - by foxholenoob - Oct-12-2023, 07:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to generating multiple json files using python script dzgn989 4 439 May-10-2024, 03:09 PM
Last Post: deanhystad
  encrypt data in json file help jacksfrustration 1 529 Mar-28-2024, 05:16 PM
Last Post: deanhystad
Exclamation Json API JayPy 4 633 Mar-04-2024, 04:28 PM
Last Post: deanhystad
  json loads throwing error mpsameer 8 1,009 Jan-23-2024, 07:04 AM
Last Post: deanhystad
  Parsing large JSON josvink66 5 859 Jan-10-2024, 05:46 PM
Last Post: snippsat
  parse json field from csv file lebossejames 4 957 Nov-14-2023, 11:34 PM
Last Post: snippsat
  format json outputs ! evilcode1 3 1,881 Oct-29-2023, 01:30 PM
Last Post: omemoe277
  TypeRoor reading json GreenLynx 3 1,036 May-16-2023, 01:47 PM
Last Post: buran
  Python Script to convert Json to CSV file chvsnarayana 8 2,887 Apr-26-2023, 10:31 PM
Last Post: DeaD_EyE
  Loop through json file and reset values [SOLVED] AlphaInc 2 2,484 Apr-06-2023, 11:15 AM
Last Post: AlphaInc

Forum Jump:

User Panel Messages

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