最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Kivy JsonStore: can you customize its encoder that converts data structures tofrom .json format? - Stack Overflow

programmeradmin1浏览0评论

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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论