json_parse.hpp 594 B

12345678910111213141516
  1. #pragma once
  2. #include <string_view>
  3. #include <nlohmann/json.hpp>
  4. namespace smartbotic::db {
  5. // Parses a JSON document using yyjson (read-only DOM) and materialises an
  6. // nlohmann::json tree from it. Drop-in replacement for nlohmann::json::parse
  7. // at hot paths where parse speed matters but we still want nlohmann semantics
  8. // downstream. Throws nlohmann::json::parse_error on malformed input so existing
  9. // catch sites keep working.
  10. nlohmann::json parse_to_nlohmann(std::string_view bytes);
  11. nlohmann::json parse_to_nlohmann(const char* data, size_t length);
  12. } // namespace smartbotic::db