Skip to content

Instantly share code, notes, and snippets.

@ivanstojic
Created March 11, 2022 07:44
Show Gist options
  • Save ivanstojic/c665233b9628883a76f5b992aa1dbf69 to your computer and use it in GitHub Desktop.
Save ivanstojic/c665233b9628883a76f5b992aa1dbf69 to your computer and use it in GitHub Desktop.
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include <iostream>
using namespace rapidjson;
int main() {
const char* json = "{\"shit\":-1.1030161663305387}";
Document d;
d.Parse(json);
StringBuffer buffer;
Writer<StringBuffer> writer(buffer);
d.Accept(writer);
std::cout << json << std::endl;
std::cout << buffer.GetString() << std::endl;
return 0;
}
@ivanstojic
Copy link
Author

output, unexpectedly:

{"shit":-1.1030161663305387}
{"shit":-1.103016166330539}

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