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
Is there a way to configure jsonpickle or extend/override its code to use a different name for the "py/object" key? Specifically, I'd like to name the key "type" instead.
I suspect specifying a different pickler class would be a possible approach. I'd also like to change how the value of the key is formatted, too. For example, using the sample code on the front page of the documentation, rather than using the value "__main__.Thing", I'd like it to use simply "Thing".
The text was updated successfully, but these errors were encountered:
At the moment, there is not a way to make it use a different key. The issue with that would be that jsonpickle matches the value's type based on the name of the key.
If you want to make a custom pickler/unpickler class, I believe you could do it by somehow modifying this line:
Is there a way to configure jsonpickle or extend/override its code to use a different name for the
"py/object"
key? Specifically, I'd like to name the key"type"
instead.I suspect specifying a different pickler class would be a possible approach. I'd also like to change how the value of the key is formatted, too. For example, using the sample code on the front page of the documentation, rather than using the value
"__main__.Thing"
, I'd like it to use simply"Thing"
.The text was updated successfully, but these errors were encountered: