-
The example is a timestamp in seconds since unix epoch time. How can I use json.Number in a struct (unmarshaling and marshaling to float64)? |
Beta Was this translation helpful? Give feedback.
Answered by
ohler55
Oct 7, 2023
Replies: 1 comment 6 replies
-
I'm not clear on the question. Let me try to get some details. Give a struct that contains a json.Number you want the representation in a JSON string to be decimal only format and not scientific notation in the JSON. You also want to marshal and unmarshal the JSON into a float64 presumably into a different struct. Is that correct? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current develop branch now has a ojg.Option.FloatFormat which can be used when writing floats. Not much I can do about the json.Number other than providing an option for something other than jsonNumber when a number is too large but that doesn't solve the json.Number output flexibility.