Skip to content

Numbers as strings #799

Description

@tomba

Hi,

Is there a way to get the json data in its original string format? The problem is that the following code:

	auto j = json::parse("[ 0.1 ]");

	auto& v = j.at(0);

	stringstream ss;
	ss << fixed << setprecision(50) << v.get<double>();
	string str = ss.str();

produces:

"0.10000000000000000555111512312578270211815834045410"

Being able to get the original string data would fix the floating point problems and also allow handling of integer numbers larger than 64 bit.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions