-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dump returns methods from list #139
Comments
Hi Jesse, thanks for reporting. I've looked into your issue and I think that the problem lies with the way you instantiated >>> test = {"children":[{"name": "Ramon"}]}
>>> Person(**test)
Person(children=[{'name': 'Ramon'}]) Notice that for this instance The following works as expected: >>> jsons.dump(Person(children=[Child(name="Ramon")]))
{'children': [{'name': 'Ramon'}]} |
Nice catch, I didn't noticed that. This is a issue indeed. But nevertheless what explains the difference between version 1.4.2 and 1.5.0? |
As of 1.5.0, there is a dedicated list_serializer that takes the To be honest, I would have expected jsons to raise an error here, since it should have tried to dump a dict as if it were a I think it's a bit hairy, I'll check into this a bit more and may still come with a patch eventually. |
When dumping a List of a dataclasses it returns method names instead of the data.
This issues is introduced in V1.5.0 (v1.4.2 works as expected). I think commit d2b36fd introduced the issue.
See below for minimal poc to replicate the issue:
results in
{'children': [{'clear': {}, 'copy': {}, 'fromkeys': {}, 'get': {}, 'items': {}, 'keys': {}, 'pop': {}, 'popitem': {}, 'setdefault': {}, 'update': {}, 'values': {}}]}
The text was updated successfully, but these errors were encountered: