Using Custom Transcoder for N1QL Query

Hey guys,
I want to use a custom transcoder to parse the N1QL results I get. (To directly have the JSON obj in my favourite lib).
By a quick look at the code, I see on N1qlQueryExecutor class that the JSON_OBJECT_TRANSCODER is hard coded as the transcoder for the query results.

Is there there any way of passing another transcoder ?
If not, are you guys plan to add this kind of behaviour ? (that would be fantastic! :slight_smile: )


Which client language / SDK are you using?

Pretty sure it is Java!

Right now there is no way to change it, but we can investigate how much effort and API surface it would be!

@simonbasle wdyt?

Btw, for now you can call toString on it for the raw JSON representation - of course a little more overhead than the real solution :smile:

Hey, Thanks for the quick responses,
@daschl, Indeed it’s the Java SDK.
And calling the toString method and re-building the JSON obj is exactly what i’m trying to avoid :smile:

Would be great to save this overhead.

Yeah, that’s what I figured - I opened a ticket to track this:

@idanna are you only interested in used your own unmarshalling for the individual rows?

if so, maybe what we could do is provide a β€œbyteValue()” method on (Async) N1qlQueryRow that will output byte[] instead of JsonObject, and have β€œvalue()” build upon this to expose the bytes as JsonObject.

1 Like

That sounds fair enough!

The feature will be available in 2.2.4, out February :smile: :thumbsup:

1 Like