Skip to content

[Feature Request] Ability to configure bigint serialization #2344

@dnechay

Description

@dnechay

Issue description

Atm pino uses safe-stable-stringify that is configured with bigint: true to serialize values when JSON.stringify fails with errors. It can lead to tricky behavior, e.g.:

Suggestion

It would be nice to have some sort of bigint: replacer | false option in pino configuration, that would:

  • when false: disable any serialization of bigint and re-throw error from JSON.stringify, so pino users are explicitly warned and can decide how to serialize bigint
  • when no value - use some default behavior (now - serializing to "number")
  • when custom replacer is provided - use it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions