-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add serializeToString() method #213
base: main
Are you sure you want to change the base?
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 <[email protected]>
…java Co-authored-by: Sylvain Wallez <[email protected]>
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.