-
Notifications
You must be signed in to change notification settings - Fork 20
Description
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?