Untitled

Run Settings
LanguagePython
Language Version
Run Command
import json s = set([1,2,3]) try: print(json.dumps(s)) except TypeError as e: print("Need a custom encoder") class MyEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, (bool, dict, float, int, list, str, type(None))): return json.JSONEncoder.default(self, obj) if isinstance(obj, set): return list(obj) print(json.dumps(s, cls=MyEncoder))
Editor Settings
Theme
Key bindings
Full width
Lines