java获取json格式中的值
import org.json.JSONArray;
import org.json.JSONException;
public class test2 {
public static void main(String[] args) throws JSONException {
String str = "[{'columnId':5,'columnName':'⼈⽂历史'},{'columnId':2,'columnName':'商业视野'}]}";
JSONArray jsonArray = null;
jsonArray = new JSONArray(str);
System.out.JSONObject(0).get("columnName"));
}
}
/
**
* 项⽬变更详情
* @param request
* @param response
* @throws Exception
*/
@RequestMapping("detail")json值的类型有哪些
@Action(description="编辑项⽬变更表")
public ModelAndView detail(HttpServletRequest request) throws Exception{
Long Long(request,"recordId",0L);
FundRecords fundRecord = ById(recordId);
FundModify fundModify = ByRecordId(recordId);
String fileName = ModifyFile();//failName = [{"id":"10000058240001","name":"附件.xls"}] net.sf.json.JSONArray jsonArray = net.sf.json.JSONArray.fromObject(fileName);
String fileNames = "";
for (int i = 0; i < jsonArray.size(); i++) {
  fileNames += JSONObject(i).get("name")+",";
}
fileNames = fileNames.substring(0, fileNames.lastIndexOf(","));
return getAutoView().addObject("recordId", recordId).addObject("fundRecords", fundRecord)
.addObject("fundModify", fundModify).addObject("fileNames", fileNames);
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。