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

Spray-json None values are always converted to null. How to change this? #73

Closed
myDisconnect opened this issue Sep 2, 2020 · 6 comments · Fixed by #74
Closed

Spray-json None values are always converted to null. How to change this? #73

myDisconnect opened this issue Sep 2, 2020 · 6 comments · Fixed by #74

Comments

@myDisconnect
Copy link

myDisconnect commented Sep 2, 2020

Spray converts None values to null only when NullOptions trait is added but by default it doesn't add those fields to JSON.
When using kebs implicitly[RootJsonFormat[xxx]], it converts None values to null. Example of such case: https://scastie.scala-lang.org/myDisconnect/tgnMaqh4QcCdQWDBWQZT5A/7 see f4 field (this is also visible in Kebs tests)
Is it possible to change this behaviour in Kebs and ignore None values?

Note: This seems to be happening when a case class has more than 22 parameters

@myDisconnect myDisconnect changed the title Spray-json None values are always converted to null (How to stop this? Spray-json None values are always converted to null. How to change this? Sep 2, 2020
@luksow
Copy link
Contributor

luksow commented Sep 2, 2020

I think that providing your own optionJsonFormat would help... Have you analysed why is that happening? Sounds like a bug in spray.

@myDisconnect
Copy link
Author

Hey @luksow, I updated the issue description and added a sample, I don't think it's related to Spray

@luksow
Copy link
Contributor

luksow commented Sep 4, 2020

Thanks for detailed report. I've found out why. It's a bug and we'll try to fix it.

@myDisconnect
Copy link
Author

🥳 When will the new version will be released?

@pk044
Copy link
Collaborator

pk044 commented Sep 15, 2020

@myDisconnect We will try to get it released this week.

@pk044
Copy link
Collaborator

pk044 commented Sep 19, 2020

@myDisconnect FYI: the new release is already available on Maven Central

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

Successfully merging a pull request may close this issue.

3 participants