The data I work with has a fixed 5 digits of precision. I'd like to enforce this when generating the JsNumber's so that i.e. floating point inaccuracies would not generate any .123450000000000001 output, ever.
Is this possible? I haven't found out a way to do it.
You can define a custom
JsonWriter
to do this (within your protocol or wherever else with a higher-precedence implicit scope):Change the rounding mode/method to taste.