Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support converting result data to JS built-ins #125

Open
jraymakers opened this issue Jan 28, 2025 · 0 comments
Open

Support converting result data to JS built-ins #125

jraymakers opened this issue Jan 28, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@jraymakers
Copy link
Contributor

The get...Json methods support converting result data to JSON-serializable objects (or arrays). This is useful when serializing to JSON is desired, such as for transfer over the network. But sometimes it's useful to convert the results to JS built-ins, including types such as BigInt and Date, that aren't valid in JSON. This might be done, for example, to interface with another JS library expecting such types.

This could be added fairly easily with an alternate converter. In addition to return BigInt or Date where appropriate, floating-point values can return the JS values NaN and Infinity (which aren't valid JSON).

Perhaps some configuration options could be exposed, such as converting BigInts to Numbers (which is lossy), or returning timestamps as numbers, instead of converting to JS Date (which loses precision in some cases).

@jraymakers jraymakers self-assigned this Jan 28, 2025
@jraymakers jraymakers added the enhancement New feature or request label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant