title: Create a CN1 JSON Array from POJO for Jackson
body: <p>Ok i got some problems getting my CN1 side POJO from the device to my Rest service which can consume and produce JSONs.</p>
  
  <p>I managed to consume the JSON generated by Jackson to parse on the device and put it on the internal SQLite Database, there is one added field on the Device side as i needed a foreign key to store in the SQLite DB. So i copied the POJO from the Restservice, removed the Hibernate annotations and added the foreign key.</p>
  
  <p>On the Restservice side, i have Hibernate running so there is no foreign key needed, it works by ArrayLists and maps properly.</p>
  
  <p>So obtaining elements from the service works fine, problem now is to get the updated elements back to the Service and the Database.</p>
  
  <p>On the device side, i am running the CN1-data-utils library to fetch and save items on the SQLite db.</p>
  
  <p>These items are read to an ArrayList and from there i want to push them as a JSON Array back to the Rest Service which should according to the correct Format directly deserialize that JSON to an Object.</p>
  
  <p>Syncronization Method on CN1 side:</p>
  
  <pre><code>        Database db = Display.getInstance().openOrCreate(DBNAME);
          DAOProvider provider = new DAOProvider(db, SQLCONFIG, DBVERSION);
          provider.set("task", new TaskDAO(provider));
          TaskDAO taskDAO = (TaskDAO) provider.get("task");
          ArrayList&lt;Task&gt; tasks = (ArrayList&lt;Task&gt;) taskDAO.fetchAll();
  
          ArrayList tasksForService = new ArrayList();
          for (Task task : tasks) {
              tasksForService.add(task.toJSON());
          }
  
          JSONObject tasksAsJSON = new JSONObject();
          tasksAsJSON.put("tasks", tasksForService);
          // tasksAsJSON.put("tasks", tasksForService);
          db.close();
  </code></pre>
  
  <p>and this looks like this</p>
  
  <pre><code>{"tasks":["id=100001, name=somestuff, plannedDate=null, finishDate=null, status=5, commentary=xy, signature=100001_30.03.2016_signature.png","id=100002, name=somestuff2, plannedDate=null, finishDate=null, status=5, commentary=no comment, signature=100002_30.03.2016_signature.png","id=100004, name=bob, plannedDate=null, finishDate=null, status=5, commentary=, signature="]}
  </code></pre>
  
  <p>I am doing something wrong here as i have a different format as which i get from the service f.e. it looks like this and differs a lot.</p>
  
  <pre><code>[{"id":100004,"name":"bob","plannedDate":1461103200000,"finishDate":1461106800000,"status":1,"description":null,"commentary":"","signature":""},
  {"id":100001,"name":"somestuff","plannedDate":1457910000000,"finishDate":1459288800000,"status":1,"description":"blablub","commentary":"xy","signature":"100001_30.03.2016_signature.png"}]
  </code></pre>
  
  <p>and the Task.java on CN1, just for the case someone wants to know what the toJSON Method does, i tried this approach but this cant be the correct solution.</p>
  
  <pre><code>@Override
      public String toString() {
          return "Task [id=" + id + ", projectId=" + projectId + ", name=" + name + ", plannedDate=" + plannedDate + ", finishDate=" + finishDate + ", status=" + status
                  + ", commentary=" + commentary + ", signature=" + signature + "]";
      }
  
      public String toJSON() {
          return "id=" + id + ", name=" + name + ", plannedDate=" + plannedDate + ", finishDate=" + finishDate + ", status=" + status + ", description=" + description
                  + ", commentary=" + commentary + ", signature=" + signature;
      }
  </code></pre>
  
  <p>If someone may post a small example for producing an JSON Array with CN1JSON?</p>