You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
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
andInfinity
(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).
The text was updated successfully, but these errors were encountered: