qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
nlohmann::jsonb Struct Reference

A wrapper around nlohmann::json providing a qb::jsonb type, often used for binary JSON (BSON) or similar dense representations. More...

#include <json.h>

Public Types

using json = nlohmann::json

Public Member Functions

 jsonb ()=default
 Default constructor.
 jsonb (const json &j)
 Constructs from an existing nlohmann::json object (copy).
 jsonb (json &&j) noexcept
 Constructs from an existing nlohmann::json object (move).
 jsonb (std::initializer_list< json::value_type > init)
 Constructs from an initializer list, same as nlohmann::json.
 operator json & ()
 Implicit conversion to a mutable reference to the underlying nlohmann::json object.
 operator const json & () const
 Implicit conversion to a constant reference to the underlying nlohmann::json object.
json & operator= (const json &j)
 Assigns from another nlohmann::json object (copy).
json & operator= (json &&j) noexcept
json & operator[] (const std::string &key)
const json & operator[] (const std::string &key) const
json & operator[] (size_t i)
const json & operator[] (size_t i) const
json * operator-> ()
const json * operator-> () const
auto begin ()
auto end ()
auto begin () const
auto end () const
std::string dump (int indent=-1) const
bool is_null () const
bool is_object () const
bool is_array () const
bool is_string () const
bool is_number () const
bool is_boolean () const
std::size_t size () const
bool empty () const
void clear ()
void push_back (const json &value)
void erase (const std::string &key)
bool contains (const std::string &key) const
json & unwrap ()
 Provides direct mutable access to the underlying nlohmann::json object.
const json & unwrap () const
 Provides direct constant access to the underlying nlohmann::json object.

Public Attributes

json data
 The underlying nlohmann::json object storing the JSON data.

Detailed Description

A wrapper around nlohmann::json providing a qb::jsonb type, often used for binary JSON (BSON) or similar dense representations.

This struct primarily forwards operations to an internal nlohmann::json member. It offers a distinct type within the qb namespace that can be specialized or handled differently from nlohmann::json directly, particularly in serialization contexts (like MessagePack potentially mapping to BSON-like structures). Most methods are direct passthroughs to the underlying nlohmann::json object.

Constructor & Destructor Documentation

◆ jsonb()

nlohmann::jsonb::jsonb ( )
default

Default constructor.

Creates an empty/null JSON object.

Member Function Documentation

◆ unwrap() [1/2]

json & nlohmann::jsonb::unwrap ( )
inline

Provides direct mutable access to the underlying nlohmann::json object.

Returns
Reference to the internal nlohmann::json data.

◆ unwrap() [2/2]

const json & nlohmann::jsonb::unwrap ( ) const
inline

Provides direct constant access to the underlying nlohmann::json object.

Returns
Constant reference to the internal nlohmann::json data.