Encode/decode Python data structures to/from JSON-encoded strings.
| 66 | |
| 67 | |
| 68 | class JSONCodec(Codec[Any, str]): |
| 69 | """ |
| 70 | Encode/decode Python data structures to/from JSON-encoded strings. |
| 71 | """ |
| 72 | |
| 73 | def encode(self, value: Any) -> str: |
| 74 | return str(json.dumps(value)) |
| 75 | |
| 76 | def decode(self, value: str) -> Any: |
| 77 | return json.loads(value) |
| 78 | |
| 79 | |
| 80 | class ZlibCodec(Codec[bytes, bytes]): |
no outgoing calls