Instead of storing the json number value as an integer or float, store it as a string, and then let the user decide how to read it.
This could potentially cause problems if the json stream is transient, meaning we would have to make a copy of the string.
Potentially, if we know the string is an integer and fits within an int, then we could eagerly parse it.
Otherwise, we can store numbers using a SSO string. Currently the union contains a string, which is 16 bytes. So a 16 byte character array is possible without allocating.
Instead of storing the json number value as an integer or float, store it as a string, and then let the user decide how to read it.
This could potentially cause problems if the json stream is transient, meaning we would have to make a copy of the string.
Potentially, if we know the string is an integer and fits within an int, then we could eagerly parse it.
Otherwise, we can store numbers using a SSO string. Currently the union contains a string, which is 16 bytes. So a 16 byte character array is possible without allocating.