Python 通过嵌套json读取胡须
我有一个json文件,我想创建一个从json开始填充的小胡子模板 在json文件下面:Python 通过嵌套json读取胡须,python,json,templates,mustache,Python,Json,Templates,Mustache,我有一个json文件,我想创建一个从json开始填充的小胡子模板 在json文件下面: { "paths": { "/firstElem": { "post": { "tags": [ "elements" ], "description": "First element"
{
"paths": {
"/firstElem": {
"post": {
"tags": [
"elements"
],
"description": "First element",
"requestBody": {
"description": "Describe first element request data",
"required": false,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/firstElemRequestData"
}
}
}
},
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/firstElemResponse"
}
}
}
}
}
}
},
"/secondElem": {
"post": {
"tags": [
"elements"
],
"description": "Second element",
"requestBody": {
"description": "Describe second element request data",
"required": false,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/secondElemRequestData"
}
}
}
},
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/secondElemResponse"
}
}
}
}
}
}
}
}
}
/firstElem
和/secondElem
是在json文件中以友好方式创建的,因此我不知道它们将使用哪个名称。我想做的是创建一个小胡子模板,并获得所有这些/firstElem、/secondElem等..
我想写一个小胡子模板来读取json中的/firstElem
和/secondElem
,并打印它们的描述
谢谢