【发布时间】:2018-03-05 13:36:24
【问题描述】:
{
"name": "ssf",
"attribute_type": "Compound",
"is_included": 1,
"subAttributes": [
{
"name": "dtfg",
"sub_data_type": "string",
"sub_dateFormat": "",
"sub_numericFormat": "",
"sub_stringFormat": "dxcf",
"subDataLength": "56",
"subMatchType": "direct",
"subCheckLevenshtein": false,
"subCheckJaroWinkler": false,
"subCheckHammingDistance": false,
"subCheckMongeElkan": false,
"sub_formula": "",
"id": "p_id"
},
{
"name": "rsdxcfgvjbh",
"sub_data_type": "date",
"sub_dateFormat": "mm_dd_yyyy",
"sub_numericFormat": "",
"sub_stringFormat": "",
"subDataLength": "45",
"subMatchType": "direct",
"subCheckLevenshtein": false,
"subCheckJaroWinkler": false,
"subCheckHammingDistance": false,
"subCheckMongeElkan": false,
"sub_formula": "",
"id": "p_id"
}
]
}
您好,我正在 Spring Boot Java 中编写 rest api。从邮递员那里,我正在发送嵌套的 json,并想使用 jdbc 准备好的语句将数据保存在 mysql 数据库中。请告诉我如何使用 for 循环和其他方法打印这个嵌套的 json 子属性。
【问题讨论】:
-
您能添加到目前为止您尝试过的示例代码吗?
-
PreparedStatement st=con.prepareStatement(query); st.setString(1, 名称); st.setString(2, 属性类型); System.out.println(name); System.out.println(attribute_type); int i=st.executeUpdate(); System.out.println(i);
-
现在我无法访问数组类型的子属性。
-
@RequestMapping(value = "/api/matchingAttribute", method = RequestMethod.POST,headers={"Accept=*/*","content-type=application/json"}) 公共字符串NewMatchingAttribute(@RequestBody MatchingAttribute matchingAttribute) 抛出 SQLException { DbConnection ObjdbInit = new DbConnection();连接 con=ObjdbInit.dbConnection();
标签: java spring spring-boot