2

Is there a way to ignore null values when stringify? Currently it renders as:

"field":null

it would be great if there is a way that null fields are not rendered at all - but I did not find such an option. Anyone knows how this can work?

1
  • 1
    What you are looking for is against the standard. You have an object with a variety of elements, including one named "field" (as in your example). In some cases, it just happens that this specific element was not assigned any value and hence it is null. This does NOT mean that the element had been removed from the object. Commented May 2, 2018 at 11:15

1 Answer 1

1

Currently it's not possible, but you may want to keep track of this issue: https://github.com/Kotlin/kotlinx.serialization/issues/58

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.