jsonã®encodeã¨ã©ã¼ã«ã¤ãã¦ã¯æã«æ¸ãããã®è¾ºãè¦ã¦ãããã¨ãã¦ã pythonã§jsonåºåããéã§å¯¾å¿ãã¦ããªãå(e.g. datetime)ã®å¤ãå¤æããªããåºåããã - Qiita ä»åã®ä¸»é¡ã¯ãjson.dumpsã«æ¸¡ãdefaultã®é¢æ°ã¨ãã¦functools.singledispatchãæç¨ããã¨ãã話ã 使ããã singledispatchãå©ç¨ããã¢ã¸ã¥ã¼ã«ãå®ç¾© ä¾ãã°ä»¥ä¸ã®ãããªextjsonã¢ã¸ã¥ã¼ã«ãå®ç¾©ãã¦ãããã extjson.py import json from functools import ( singledispatch, partial, ) @singledispatch def encode(o): raise TypeError("Object of type '%s' is not JSON serializable"
{{#tags}}- {{label}}
{{/tags}}