我有一个看起来像的 JSON 对象
{
"timestamp": "2020-06-24T15:32:56.775518Z",
"record-type": "data",
"operation": "load",
"partition-key-type": "primary-key",
"schema-name": "legacy",
"table-name": "test"
}
我正在尝试将记录反序列化为
class MetadataModel(faust.Record):
timestamp: str
record-type: str # does not work, hyphens in name not allowed
schema_name: str # does not work
tableName: str # does not work
我可能遗漏了一些简单的东西,但是如何从键中有连字符的 json 对象转到 python 对象。任何帮助将非常感激!