mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
20 lines
672 B
C++
20 lines
672 B
C++
#include "simdjson.h"
|
|
int main(void) {
|
|
simdjson::padded_string json;
|
|
auto error = simdjson::padded_string::load("twitter.json").get(json);
|
|
if (error) { std::cerr << error << std::endl; return EXIT_FAILURE; }
|
|
|
|
simdjson::builtin::ondemand::parser parser;
|
|
simdjson::builtin::ondemand::document tweets;
|
|
error = parser.iterate(json).get(tweets);
|
|
if (error) { std::cerr << error << std::endl; return EXIT_FAILURE; }
|
|
|
|
uint64_t count;
|
|
error = tweets["search_metadata"]["count"].get(count);
|
|
if (error) { std::cerr << error << std::endl; return EXIT_FAILURE; }
|
|
|
|
std::cout << count << " results." << std::endl;
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|