如何从字符串下方获取值和显示?
[
{
"hdr":"",
"forElement":"",
"preFields":[
],
"rows":[
[
{
"field":"subject_area",
"label":"Subject Area",
"mandatory":"",
"type":"text",
"giveFocus":"",
"reference":"",
"choiceOptions":null,
"refQual":"",
"onChangeFunc":"",
"cellCSS":"",
"labelCSS":"",
"show":"always",
"imageSrc":"",
"value":"helo",
"display":"helods",
"relatedTable":"",
"disabled":false
},
{
"field":"table",
"label":"Table",
"mandatory":"",
"type":"text",
"giveFocus":"",
"reference":"",
"choiceOptions":null,
"refQual":"",
"onChangeFunc":"",
"cellCSS":"",
"labelCSS":"",
"show":"always",
"imageSrc":"",
"value":"helasdsao",
"display":"helo",
"relatedTable":"",
"disabled":false
},
{
"field":"column",
"label":"Column",
"mandatory":"",
"type":"text",
"giveFocus":"",
"reference":"",
"choiceOptions":null,
"refQual":"",
"onChangeFunc":"",
"cellCSS":"",
"labelCSS":"",
"show":"always",
"imageSrc":"",
"value":"hesadslo",
"display":"helo",
"relatedTable":"",
"disabled":false
},
{
"field":"description",
"label":"Description",
"mandatory":"",
"type":"text",
"giveFocus":"",
"reference":"",
"choiceOptions":null,
"refQual":"",
"onChangeFunc":"",
"cellCSS":"",
"labelCSS":"",
"show":"always",
"imageSrc":"",
"value":"helo",
"display":"hedsadlo",
"relatedTable":"",
"disabled":false
}
]
]
}
]
答案 0 :(得分:0)
使用python:
import json
y=json.loads('<put or read your json string>')
rows=y[0]['rows'][0]
for row in rows:
value=row['value']
display=row['display']
print(value+','+ display)