Skip to content

Conversation

@georgelemon
Copy link

tests included

Signed-off-by: George Lemon <georgelemon@protonmail.com>
@pietroppeter
Copy link
Contributor

Great idea! I guess an example in the Readme would also be welcome, so that the feature is discoverable (I am not the maintainer)

Signed-off-by: George Lemon <georgelemon@protonmail.com>
@georgelemon
Copy link
Author

georgelemon commented Apr 2, 2024

The best use case scenario is when working with APIs. I want to use jsony to serialize/deserialize objects in requests & responses. For example

type
  Product = object 
    id, slug: string          # filled by the server
    published: bool
    title, content: string

When making a POST request, I can't send an object that contains an emptyid field (or slug), because those fields are available in a GET request, so most probably I will get an error from the server. Reusing the same Nim object and stripping fields based on their values would be possible with the runtime skipHook

Signed-off-by: George Lemon <georgelemon@protonmail.com>
@esafak
Copy link
Contributor

esafak commented Jul 27, 2025

@treeform Any objections to merging?

@georgelemon Could you summarize the README in this PR description so the commit has the relevant details?

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

Successfully merging this pull request may close these issues.

3 participants