# serialization


03/17/2023, 10:00 AM
Hi! I’ve encountered a missing feature in the kotlinx.serialization library.. We’re using the serialization library for JSON requests and responses and for each request we’re doing we get a response with some data, but the JSON also contains a metadata object describing the response data. We currently aren’t doing anything with the metadata and aren’t planning on using it, so we set the serializer to ignore unknown keys. We really want to validate the incoming JSON using the model. In the past we’ve encountered some unwanted behaviour because either the response data or our model changed.. So basically we want to ignore only specific keys while deserializing (the metadata object). Unfortunately this isn’t possible in the library. I’ve found some issue on the github about this feature and I’ve gone ahead and implemented the feature. I already put up a pull request ( But, how to proceed, just wait until it gets reviewed, or should we discuss it?

Adam S

03/17/2023, 10:17 AM
if you’re looking for a way to ignore properties today, I had a couple of suggestions in this thread: TBH I’m not a fan of the annotation approach, but I think it would be useful if KxS provided some easier-to-use functionality for this


03/17/2023, 10:22 AM
Thanks Adam, although it’s not as nice I hoped it’s the best solution we have at present and will implement it until we get a better option..
@Adam S I’ve tried out the IgnoredField approach but I can’t get it to work since our
is an object, so using a primitive descriptor fails. For now I’ve set it to JsonElement, made it private and added the deprecation annotation