Skip to content

Treating floating point as string #1627

Description

@MarkoPaul0

Hey everyone I have been trying to figure out if there was a way for me to access the underlying "raw text" of a numeric value.
Let's say I have the following json:

{
  "some_number": 123443567.8982593898749283794837298749832798798
}

Here I want to treat some_number as a "bunch of digits", meaning the node is still of numeric type but I don't want to rely on any parsing capabilities from this library. Would it be possible for me to get the underlying array of characters that is contained in the json file for a given numeric node?
In other words, I would like to do something like this

std::string raw_value = some_number_node.rawDump();
std::cout << "Raw value: {" << raw_value << "}" << std::endl;

Which would print:

{123443567.8982593898749283794837298749832798798}

Is this doable?

Thanks a lot!

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions