You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Adding a JSON cast to a models attribute I would expect a create to serialise the List assigned to the attribute into a string before saving.
To Reproduce
Note the "roles" column type is set as JSON on the db table
throws error similar to the following:
the JSON object must be str, bytes or bytearray, not list
Interestingly if I remove the casts and dump to json myself like this
"role": json.dumps(['admin', 'user'])
everything works as expected.
Looking at the JsonCast class it only passes 'dict' objects through
Ideally this should include lists as the json for them (like dicts is a direct correlation
Expected behavior
the list should be serialised and deserialised transparently in the model.
Desktop (please complete the following information):
OS: Mac OSX
Version Catalina 10.15.7
What database are you using?
Type: Postgres
Version 10.5
Masonite ORM v2.2.0
The text was updated successfully, but these errors were encountered:
Describe the bug
Adding a JSON cast to a models attribute I would expect a create to serialise the List assigned to the attribute into a string before saving.
To Reproduce
Note the "roles" column type is set as JSON on the db table
Steps to reproduce the behavior:
Model example:
throws error similar to the following:
the JSON object must be str, bytes or bytearray, not list
Interestingly if I remove the casts and dump to json myself like this
"role": json.dumps(['admin', 'user'])
everything works as expected.
Looking at the JsonCast class it only passes 'dict' objects through
Ideally this should include lists as the json for them (like dicts is a direct correlation
Expected behavior
the list should be serialised and deserialised transparently in the model.
Desktop (please complete the following information):
What database are you using?
The text was updated successfully, but these errors were encountered: