admin管理员组文章数量:1357602
I'm adding storage to my python Kivy application.
My data involves many enums and nested dictionaries/sets so out-of-the-box, JsonStorage fails with errors like "TypeError: Object of type set is not JSON serializable". I think DictStore can handle these types, but I would prefer to use JsonStore over DictStore because I like that .json is human readable allowing me to edit storage values directly during development.
IIUC python makes its built-in JSON en/decoder extendible. So I'm wondering if there's a way I could edit/extend the JsonStore class to refer to a different encoder which I could write to correctly (de)serialize these complex data types that are causing the failure.
本文标签:
版权声明:本文标题:python - Kivy JsonStore: can you customize its encoder that converts data structures tofrom .json format? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743969375a2570479.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论