Skip to content

[Question] Floating point resolution config during dump() ? #768

Description

@rstoica

Hello,

First of all I would like to thank for doing such a nice job in developing and maintaining a top-notch C++ JSON code base!

I am a new user of this library, so maybe my question may be well documented somewhere, but I might have overlooked the explanation (if this is the case apologies beforehand but please point it out to me).

Is there any functionality exposed to limit the floating point resolution during dump() ?

Context: I am asking this as I am not using the basic output streams or its derivatives but an MQTT publisher. So basically I just dump the JSON objects that I have to the MQTT interface as a string. As of now, the float data fields have by default 10 or so decimal places as explained in the documentation, but is there a flag / API to restrict that to a configurable number, e.g. 2 decimals only ?

Best,
Andrei

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: questionsolution: proposed fixa fix for the issue has been proposed and waits for confirmationstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updated

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions