Couchbase SDK 3.x - INSERT Statement input query

Hi Team,

I am using Couchbase Java SDK 3.x.
When I am trying to insert String document as Input for INSERT Statement,
Object does not escape special characters (escape sequences) of string values and storing json string with escape characters- resulting in an invalid Json string that cannot be serialized back to a Json object

e.g [Couchbase Bucket].defaultCollection().insert(documentId, document);
document => Passing string value for JSON document.

Is there way to store String with valid Json format ?

1 Like

Hi @Vaibhav
Please see the doc on transcoding and non-JSON documents, which should answer all your questions - in particular the RawStringTranscoder.

1 Like

@Vaibhav should the encoded String be JSON, please use the RawJsonTranscoder.

1 Like