模式CustomerRating在另一个文件中定义。如何基于以下Python 2.7中的嵌套模式读取JSON?在读取json时是否可以导入CustomerRating模式?
交易架构 -CustomerRating模式
主模式(交易)
{"namespace" : "com.xyzpqr.customer",
"type" : "record",
"name" : "transaction",
"fields" : [
{ "name" : "firstName",
"type" : [
"null", "string"
],
"default" : null
},
{
"name" : "rating",
"type" : [ "null", "CustomerRating"],
"default" : "null"
}
]
}