I want to ignore some fields when using JSONArray:
public class Person {
private Integer id;
private String name;
//field to ignore in json
private Account account;
...
Here I use JSONArray:
public static JSONArray listToJson(List objects) throws JSONException {
return new JSONArray(objects);
}
You can use transient
key word for it.
private transient Account account;
Variables may be marked transient to indicate that they are not part of the persistent state of an object.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.