Hamza Amami
Hamza Amami

Reputation: 114

Error while accessing jsonObject in couchbase

I'm having this JSON as a couchbase document :

{
  "document": [
    {
      "Value 1": 36.29,
      "Date 1": 1495144800000,
      "Date 2": 1495144800000,
      "Date 3": 1495144800000,
      "Value 2": "5444158076"
    }
  ],
  "exception": null
}

What I want to do is to get the Date 1, Date 2 and Date 3 then change them (with JAVA).

I'm using doc.content().getString(jsonKey); to get, but it only work at the first level of the JSON (i can only get the exception value).

I don't know if I can ask at the same question, but if you also can help me with updating some value in a JSONArray (modify the Date 1/2/3 values) it would be great.

Thanks !

Upvotes: 0

Views: 49

Answers (1)

rajagp
rajagp

Reputation: 1443

Have you tried getting the array associated with "document" key (jsonKey should be "document" and then get the map associated with the first element in the array.

Upvotes: 1

Related Questions