public class User { private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void
这种用法包括前端和后端: 前端: 1. 转化为JSON对象方便操作 var jsonObj = JSON.parse(str); 得到的是一个json数组对象,可以通过 for (var p in jsonObj){} 来遍历数组中的每个对象,其中p表示key,jsonObj[p]表示key所对应的值. 2. 转化为字符串 var jsonStr = JSON.stringify(jsonObj) 后端:需要用到阿里的fastjson包(其他的用法可以参考博客:https://blog.csdn
/** * Copyright (c) 2011-2015, James Zhan 詹波 (jfinal@126.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * h