How to iteratively store and retrieve JSONArray which contains nested JSON objects in couchbase (Android)

Trying to store a JSON array into couchbase using this code in Android, put it is unsuccessful. Please help with how to successfully store it and also how to iteratively receive all data

private void storeLocalData() {

        //COUCHBASE IMPLEMENTATION
        // Create a manager
        manager = null;
        try {
            manager = new Manager(new AndroidContext(getActivity()), Manager.DEFAULT_OPTIONS);
        } catch (IOException e) {
            e.printStackTrace();
        }


        // Create or open the database named 'saved_project_sample'
        database = null;
        try {
            database = manager.getDatabase("saved_project_sample");
        } catch (CouchbaseLiteException e) {
            e.printStackTrace();
        }

        // Create a new document
        document = database.createDocument();


        try {
            //Cast json String into JSON Array
            JSONArray jsonArray= new JSONArray(json);

            HashMap<String, Object> properties = new HashMap<>();

                for (int k = 0; k < jsonArray.length(); k++) {
                    JSONObject objJson = jsonArray.getJSONObject(k);

                    Object id = objJson.getString("id");
                    Object title = objJson.getString("title");
                    Object owner_id = objJson.getString("owner_id");
                    Object description = objJson.getString("description");
                    Object status = objJson.getString("status");
                    Object start_time = objJson.getString("start_time");
                    Object finish_time = objJson.getString("finish_time");
                    Object created = objJson.getString("created");
                    Object modified = objJson.getString("modified");

                    properties.put("id", id);
                    properties.put("title", title);
                    properties.put("owner_id", owner_id);
                    properties.put("description", description);
                    properties.put("status", status);
                    properties.put("start_time", start_time);
                    properties.put("finish_time", finish_time);
                    properties.put("created", created);
                    properties.put("modified", modified);


                    document.putProperties(properties);
                Toast.makeText(getActivity(), "Successful Storage", Toast.LENGTH_SHORT).show();
                }


        } catch (CouchbaseLiteException e) {
            e.printStackTrace();
            Toast.makeText(getActivity(), "Unsuccessful", Toast.LENGTH_SHORT).show();
        } catch (JSONException e) {
            e.printStackTrace();
            Toast.makeText(getActivity(), "Unsuccessful", Toast.LENGTH_SHORT).show();
        }

    }

This is my JSON Array

[

{"id": "1", 
"title": "New API", 
"owner_id": "dsdssdsd445d", 
"description": "Yh A Testin API",
"status": "unactiveAPI",
"start_time": "2017-08-01 14:25:22.060000",
"finish_time": "2017-08-01 14:25:22.060000",
"created": "2017-08-01 14:25:22.060000",
 "modified": "2017-08-01 14:25:22.060000"},

{"id": "2", 
"title": "New TW Projec API", 
"owner_id": "dsdssdsd445d", 
"description": "Testin API",
"status": "unactiveAPI",
"start_time": "2017-08-01 14:25:22.060000",
"finish_time": "2017-08-01 14:25:22.060000",
"created": "2017-08-01 14:25:22.060000",
 "modified": "2017-08-01 14:25:22.060000"},

{"id": "3", 
"title": "Projec API", 
"owner_id": "dsdssdsd445d", 
"description": "Testin",
"status": "unactiveAPI",
"start_time": "2017-08-01 14:25:22.060000",
"finish_time": "2017-08-01 14:25:22.060000",
"created": "2017-08-01 14:25:22.060000",
 "modified": "2017-08-01 14:25:22.060000"},
 ]

It is impossible to put multiple properties of a hashmap into a singular Couchbase doucment.

You create a new document everytime by

document = database.createDocument(); 

Or

 document = database.getDocument(String documentId);

Before

document.putProperties(properties);

My code below now works properly without crashing

  ProjectSummary[] projectSummaries = new Gson().fromJson(json, ProjectSummary[].class);
        int project_number=1;
        HashMap<String, Object> properties = new HashMap<>();

        for (ProjectSummary projectSummary : projectSummaries) {


            // Create a new document - Every Project-List Will Be Its Own Document
            document = database.getDocument("Project-"+ project_number);

            properties.put("id", projectSummary.id);
            properties.put("title", projectSummary.title);
            properties.put("owner_id", projectSummary.owner_id);
            properties.put("description", projectSummary.description);
            properties.put("status", projectSummary.status);
            properties.put("start_time", projectSummary.start_time);
            properties.put("finish_time", projectSummary.finish_time);
            properties.put("created", projectSummary.created);
            properties.put("modified", projectSummary.modified);

        try {
            document.putProperties(properties);
            Toast.makeText(context, project_number+"- ID Saved", Toast.LENGTH_SHORT).show();
        } catch (CouchbaseLiteException e) {
            e.printStackTrace(); //This will tell you why it fails
            Toast.makeText(context, "failure", Toast.LENGTH_SHORT).show();
        }

        //Increase Project Number
        project_number++;

    }

    Toast.makeText(context, "Project Download Successful \n" , Toast.LENGTH_SHORT).show();

}

ProjectSummary Class for Hashmap Mapping

public class ProjectSummary {
public String id;
public String title;
public String owner_id;
public String description;
public String status;
public String start_time;
public String finish_time;
public String created;
public String modified;


public ProjectSummary() {
}

This is an option. To keep individual project objects in separate documents. That way your document size won’t grow to be very large which can have other adverse affects.

But if you have a limited number of projects, you can consider saving it as a nested array this way

{
  "projects": [
    {
      "foo": "bar"
    },
    {
      "foo2": "bar2"
    }
  ]
}

Please what are the adverse effects?

This post on data modeling options should clarify the same