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
I want to convert a Json bject to String,so I used JsonConverter.ConvertToJson fuction
my test case Json object is {"stringKey":"2024051090001075"}
after use JsonConverter.ConvertToJson, my expect str is {"stringKey":"2024051090001075"}, but got {"stringKey":2024051090001075}
The text was updated successfully, but these errors were encountered:
Douglas87
changed the title
Issue: try to use JsonConverter.ConvertToJson fuction to convert,but String value becomes Intergret Integer
Issue: try to use JsonConverter.ConvertToJson fuction to convert,but String value becomes Integer
May 11, 2024
' VBA only stores 15 significant digits, so any numbers larger than that are truncated
' This can lead to issues when BIGINT's are used (e.g. for Ids or Credit Cards),
' as they will be invalid above 15 digits
' See: http://support.microsoft.com/kb/269370
'
' By default, VBA-JSON will use String for numbers longer than 15 characters that
' contain only digits
' to override set JsonConverter.JsonOptions.UseDoubleForLargeNumbers = True
The option description applies to parsing from a JSON string. But for consistency the equivalent actions are used in the other direction when converting to JSON.
So counter-intuitively (since you aren't using Double), to keep your string value, make the option True before calling ConvertToJson.
================
If the above solves your problem, please close the issue here.
I want to convert a Json bject to String,so I used JsonConverter.ConvertToJson fuction
my test case Json object is {"stringKey":"2024051090001075"}
after use JsonConverter.ConvertToJson, my expect str is {"stringKey":"2024051090001075"}, but got {"stringKey":2024051090001075}
The text was updated successfully, but these errors were encountered: