Thank you for submitting this pull request! We appreciate you spending the time to work on these changes.
What is the motivation?
We improved toJSON support in #256 with the slight oversight that native datatypes don't generally have a toJSON method.
What does this change do?
It introduces a jsonify method which effectively JSON stringifies the passed value and then parses it again, allthough it adds typing to it to preserve the type of the passed value and converts them.
We're going with a simple stringify + parse method because we need a bit more time if something custom which would loop through all values recursively could be faster and acurate.
Thank you for submitting this pull request! We appreciate you spending the time to work on these changes.
What is the motivation?
We improved
toJSON
support in #256 with the slight oversight that native datatypes don't generally have a toJSON method.What does this change do?
It introduces a
jsonify
method which effectively JSON stringifies the passed value and then parses it again, allthough it adds typing to it to preserve the type of the passed value and converts them.We're going with a simple stringify + parse method because we need a bit more time if something custom which would loop through all values recursively could be faster and acurate.
What is your testing strategy?
Transformed the
toJSON
unit test intojsonify
Is this related to any issues?
Continuation of #256
Have you read the Contributing Guidelines?