2020-04-15 10:31:21 +08:00
|
|
|
#include <iostream>
|
|
|
|
#include "simdjson.h"
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
simdjson::error_code error;
|
|
|
|
simdjson::padded_string numberstring = "1.2"_padded; // our JSON input ("1.2")
|
|
|
|
simdjson::dom::parser parser;
|
2020-06-20 07:00:11 +08:00
|
|
|
double value; // variable where we store the value to be parsed
|
2020-06-20 06:29:55 +08:00
|
|
|
parser.parse(numberstring).get(value,error);
|
2020-04-15 10:31:21 +08:00
|
|
|
if (error) { std::cerr << error << std::endl; return EXIT_FAILURE; }
|
|
|
|
std::cout << "I parsed " << value << " from " << numberstring.data() << std::endl;
|
|
|
|
}
|