ãã¤ãã®ãã¤ã§ãã対å¿ãã¦ããªãå¤ãjson.dumps()ã«ä¸ããã¨TypeErrorãçºçãããã¤ã§ãã TypeError ä¾ãã°ããããdataclassãå®ç¾©ãã¦ã from dataclasses import dataclass, asdict @dataclass class Point: x: int y: int json.dumpsããã¨TypeError import json p = Point(x=1, y=2) # TypeError: Object of type Point is not JSON serializable print(json.dumps(p)) default ãã¤ãã©ããã«defaultã渡ãã¦ãããå¿ è¦ãããã¾ããã¡ãã£ã¨ããã©ãããã§ãããis_dataclassã¨ããé¢æ°ã§èª¿ã¹ãããã®ã§ã©ãã«ããªãã¾ãã import json
{{#tags}}- {{label}}
{{/tags}}