Skip to content
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

VerifyJson shall use the GsonBuilder function passed when reorder is false. #551

Closed
ShadyAbuKalam opened this issue Sep 13, 2024 · 1 comment

Comments

@ShadyAbuKalam
Copy link

ShadyAbuKalam commented Sep 13, 2024

I have these lines
Function1<GsonBuilder, GsonBuilder> gsonSerializeNull = GsonBuilder::serializeNulls; JsonApprovals.verifyJson(jsonString, false, gsonSerializeNull);

Internally JsonApprovals will call JsonUtils.prettyPrint that creates a new Gson object without the configuration we passed, so we still get rid of nulls, that I still want.

Some suggested possible solutions:

  1. Change the prettyPrint to accept the Gson customization function.
  2. Change the prettyPrint function to consider removing nulls is messing up with json. ( I prefer this one )
  3. Write the PrettyPrint function inside the JsonApproval module.

I am willing to do this as PR, if maintainers agree.

@LarsEckart
Copy link
Contributor

Indeed, this should have been possible before.
We did option 1 and it will be part of the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants