Skip to content

date support #139

@mfrieling

Description

@mfrieling

Describe the feature

JSON objects I receive from the backend parse fine, except dates which always will be returned as string. This is related to #73 which requests support for another data type.

JSON.parse accepts a reviver function ((key: string | number, value: any): any) and JSON.stringify a replacer function in a similar way (to provide customized serialization), see the MDN documentation about JSON.parse for details. The [ExpressJS (body-parser)[https://www.npmjs.com/package/body-parser?activeTab=readme] support reviver and replacer as well.

By supporting reviver (and for #95 replacer via the options parameter), destr could support special type or other customized parsing easily by being extensible, without the requirement of implementing those special types like Date or bigint on its own. For dates i.e. json-stringify-date a suitable solution.

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions