Conversation
This will allow generating Json String documents out of the box from any of the response/request objects.
|
@swallez I think we should try to think something even more useful. I'd love to have the method Instead of writing: SearchResponse<Person> resp = ...;
String json = new JacksonJsonpMapper().serializeToString(resp);We could write: SearchResponse<Person> resp = ...;
String json = resp.toJson();Would it be good for you? |
I'd like to limit the number of framework-related methods on API classes to the bare minimum, and I don't expect |
java-client/src/main/java/co/elastic/clients/json/JsonpMapper.java
Outdated
Show resolved
Hide resolved
java-client/src/main/java/co/elastic/clients/json/JsonpMapper.java
Outdated
Show resolved
Hide resolved
…java Co-authored-by: Sylvain Wallez <sylvain@bluxte.net>
…java Co-authored-by: Sylvain Wallez <sylvain@bluxte.net>
|
I don't really agree with the quote of @swallez '...and I don't expect serializeToString to be widely used....' |
|
@dadoonet When can we expect this to get merged? |
|
@swallez I think that we can now use: JsonpUtils.toJsonString(response, jacksonJsonpMapper);So should we close this one? |
This method
serializeToString()helps to generate the json String representation of any response or request object.This could be useful for debugging or for other usages like consuming the search response objects within a JavaScript based frontend.