Skip to content

Boost.JSON output for numbers with scientific format is incorrect #156

@sicheste

Description

@sicheste

When enabling in main.cpp lines 1139 and 1140 it is showing the differences in parsing. For the Boost.JSON it will for example print this:

Expect: [5e-324]
Actual: [5E-324]

Intput from roundtrip24.json is simply [5e-324].

Somewhere the formatting is broken. By default Boost.JSON would output e instead of E:

#include <boost/json/src.hpp>
#include <iostream>
#include <string>

int main(int, char**) {
  std::string json("[5e-342]");
  std::string result = boost::json::serialize(json);
  std::cout << "input: " << json << "\nresult: " << result << std::endl;
  return 0;
}

Output:

input: [5e-342]
result: "[5e-342]"

The exponent e is lower case here. I did not had enough time to search for some formatting settings in the application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions