Closed kenaschmidt closed 9 months ago
Hi! Thanks for reaching out! It's expected that our values will be returned in scientific notation occasionally. Let me know if there's anything else I can help you with.
Thank you for your reply - though I would ask why this is the case? It seems like poor practice if it isn't necessary, which it doesn't seem to be. Other, much larger numbers are returned elsewhere (timestamps). Returning a 7-digit volume number in scientific notations just unnecessarily complicates things IMO, especially when it's all JSON text to begin with.
In my case specifically, Newtonsoft.Json will only deserialize to an Int64 (rather than a simple int), and I just discovered that System.Text.Json will only deserialize to a double/float, which would require unneeded changes to data structures.
I'd just ask that it be looked it as something to be changed in the future; thanks!
Hello again! We appreciate the feedback! You can submit ideas through our roadmap! Users can vote on what's most important to them and we use that data to help us decide what features to work on next.
C#/.NET Framework
URL https://api.polygon.io/v3/trades/AAPL?timestamp=1703883600433723635&limit=10
Also present in some 'Stock Financials' requests.
Result Receiving values that are expressed in scientific notation; (Newtonsoft) Deserializer is unable to parse to expected value into an 'int'. Value expressed as, ie '8.13548e+8'
Expected Result Expected to receive values as a plain 'number' (int)
Screenshots Screenshot of raw JSON text received; the web interface apparently parses automatically.
Desktop (please complete the following information): C#/.NET Framework, Newtonsoft JSON deserialization
Additional context
Problem is solved by using Int64 properties rather than 'int' primitives, but returned values should still not be expressed in this form and may lead to problems if this happens in unexpected places.