ramonhagenaars / jsons

🐍 A Python lib for (de)serializing Python objects to/from JSON
https://jsons.readthedocs.io
MIT License
289 stars 41 forks source link

Duplicate data classes do not get converted into JSON properly #124

Open paulalex opened 4 years ago

paulalex commented 4 years ago

I am experiencing a strange issue with the jsons library where with a pretty large set of data classes > 4500 representing a report, I have missing column data for records where there are currently duplicates returned from the database query.

Records which do not have duplicates are rendered perfectly fine. I have debugged the output cursor, the data classes and the excel report which are all fine, the error manifests itself in the use of jsons.dump(), when I print out the json it is at that point that the json objects for duplicate rows are much smaller.

Each dataclass has 51 fields, however the duplicate dataclasses when rendered only have 4 fields rendered on and when the excel report is viewed you can clearly see these rows where there is almost no data.

paulalex commented 4 years ago

To update, I was unable to recreate this with a minimal example but it is DEFINITELY a bug in this library, I have now decided not to use it because of this reason. Converting my data classes into a dictionary with the asdict() function and the problem has gone away. I now have all of my data.

I know this doesnt really help you to diagnose the issue but it is there in both 1.1.2 and the latest version as I rolled back to test to see if it was introduced after a dependabot upgrade.