NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
json.h File Reference

Thin C++ RAII wrapper around yyjson with nlohmann-compatible API. More...

#include <neograph/api.h>
#include <yyjson.h>
#include <cstdint>
#include <initializer_list>
#include <iosfwd>
#include <ostream>
#include <map>
#include <memory>
#include <stdexcept>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for json.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Detailed Description

Thin C++ RAII wrapper around yyjson with nlohmann-compatible API.

Replaces nlohmann/json in NeoGraph. Uses yyjson (C) for parsing and serialization while preserving value semantics and a subset of the nlohmann API that NeoGraph actually uses:

  • Type queries: is_null / is_bool / is_number / is_string / is_array / is_object
  • Factories: json::object(), json::array(), json::parse(), initializer-list ctor
  • Access: operator[], at(), value(), get<T>(), contains(), size(), empty()
  • Mutation: operator[] assignment, push_back()
  • Iteration: range-based for, items() (for structured bindings)
  • Serialization: dump()
  • ADL helpers: to_json / from_json

Value semantics: copy constructor performs a deep copy. operator[] returns a json handle that shares the underlying yyjson document, allowing write- through via rvalue operator= (the j["key"] = value pattern).

Definition in file json.h.