在不知道JSON结构的情况下模仿小胡子

时间:2014-09-17 16:40:04

标签: json mustache client-side-templating

我有像这样的json数据

FixedFields: {
"DocType": {
  "fieldValueOnChange": "",
  "operatorStyle": "width:80%",
  "fieldType": "Fixed",
  "operatorOnChange": "selectFixedFieldType(this);",
  "contextpath": "/iTunes",
  "validations": {
    "alphaNumeric": {

    }
  },
  "fieldValueType": "text",
  "OperatorTypes": {
    "not equals to": "text",
    "equal to": "text",
    "paste list": "textarea",
    "starts with": "text",
    "contains": "text"
  },
  "fieldValueStyle": "width:90%"
},
"Amount": {
  "fieldValueOnChange": "",
  "operatorStyle": "width:80%",
  "fieldType": "Fixed",
  "operatorOnChange": "selectFixedFieldType(this);",
  "contextpath": "/iTunes",
  "validations": {
    "numericDouble": {
      "limit": "16"
    }
  },
  "fieldValueType": "text",
  "OperatorTypes": {
    "equal to": "text",
    "not equals to": "text",
    "between": "textbetween",
    "less than": "text",
    "less than or equal to": "text",
    "greater than": "text",
    "greater than or equal to": "text"
  },
  "fieldValueStyle": "width:35%;"
}
}

问题是我想识别标签名称和值并在胡子模板中呈现,我不知道我的Web服务响应中的JSON结构是什么样的。

我知道可以通过

进行json解析来完成
for(key in array) {...} 

我怎样才能在小胡子中进行模板化,因为我的数据不确定结构? 提前致谢

0 个答案:

没有答案