Deserialising nested Json into java object through Java -clinet
roach at basho.com
Tue Apr 7 12:07:49 EDT 2015
There is nothing in the Riak Java client to do that, no.
The result of a search query over the Riak protocol buffers API
returns the fields you queried for as a series of key/value pairs,
with the value always being a string. This is unfortunate when it
comes to mapping those values back to a class (or just serializing
them to JSON) if there was any non-string values (numbers or null).
The Java client presents a returned document as a Map<String,
List<String>> for this reason, the list being required as there could
be multiple values for a single key.
That said, it shouldn't be too difficult to write a custom
deserializer for Jackson if you know what the results are going to
look like in advance. If you could show a dump of the Map being
returned by the Riak client we may be able to help with that. Another
option would be to use a Solr client and query Solr directly rather
than going through Riak.
On Tue, Apr 7, 2015 at 8:32 AM, Santi Kumar <santi at veradocs.com> wrote:
> We have a Composite pojo which we are indexing into Riak search. If I see
> the structure of the object in solr web console, it shows as nested json.
> Through java client when we query it returns the Map and having difficulties
> in converting it into java object. Is there a way in riak-java client to
> return a pojo instead of Map and we dealing with jakson mappers?
> riak-users mailing list
> riak-users at lists.basho.com
More information about the riak-users