Example usage for org.json JSONObject append

List of usage examples for org.json JSONObject append

Introduction

In this page you can find the example usage for org.json JSONObject append.

Prototype

public JSONObject append(String key, Object value) throws JSONException 

Source Link

Document

Append values to the array under a key.

Usage

From source file:biblivre3.circulation.UsersDTO.java

@Override
public JSONObject toJSONObject(Properties properties) {
    JSONObject json = new JSONObject();

    try {// w w w  . j ava 2  s.  c  om
        json.put("totalPages", this.totalPages);
        json.put("totalRecords", this.totalRecords);
        json.put("currentPage", this.currentPage);
        json.put("recordsPerPage", this.recordsPerPage);

        for (UserDTO user : this.users) {
            json.append("results", user.toJSONObject(null));
        }
    } catch (JSONException e) {
    }

    return json;
}