Query view with compex keys in java SDK 2.x

[“peter”,“ohio”] [ “xyz”, “111”}
[“john”,“washington”] [ “xyz”, “111”}
[“peter”,“washington”] [ “xyz”, “111”}

I want to get the result if I have the exact key, this was working with java 1.x client but does not seem to work with 2.x

Get Peter in Ohio (expect 1 row)
viewQuery.key("[“peter”,“ohio”]"); giving me 0 rows.

Get All the peters(expect 2 rows)
viewQuery.startKey("[“peter”,null]");
viewQuery.endKey("[“peter”,"\u0fff"]"); giving me 0 rows.

As I mentioned it was working with the old java SDK, but new SDK does not like this for some reason.

OK I am able to get the result if I have the exact key using the below code:

JsonArray keys = JsonArray.from(“peter”, “ohio”);
viewQuery.key(keys);
This correctly returns me the result.

But I am still unable to get the second query to work i.e get all peter’s

Ok i was able to get the second query to work as well,

viewQuery.startKey(JsonArray.from(“peter”));
viewQuery.endKey(JsonArray.from(“peter” + “\u0fff”));