djson v3.1.3
JSON parser
 
Loading...
Searching...
No Matches
json.hpp File Reference
#include <djson/error.hpp>
#include <djson/string_table.hpp>
#include <expected>
#include <format>
#include <memory>
#include <span>
#include <string>
#include <utility>

Go to the source code of this file.

Classes

struct  dj::SerializeFlag
 Bit flags for serialization options. More...
 
struct  dj::SerializeOptions
 Serialization options. More...
 
class  dj::Json
 Library interface, represents a valid JSON value. More...
 
struct  std::formatter< dj::Json >
 Specialization for std::format (and related). More...
 

Namespaces

namespace  dj
 
namespace  dj::detail
 

Concepts

concept  dj::NumericT
 Numeric type.
 
concept  dj::StringyT
 Stringy type.
 
concept  dj::GettableT
 Type to obtain JSON value as.
 
concept  dj::SettableT
 Type to set JSON value to.
 

Typedefs

using dj::Result = std::expected< Json, Error >
 Parse result type.
 
using dj::SerializeFlags = decltype(std::to_underlying(SerializeFlag::None))
 

Enumerations

enum class  dj::JsonType : std::int8_t {
  dj::Null , dj::Boolean , dj::Number , dj::String ,
  dj::Array , dj::Object , dj::COUNT_
}
 JSON value type. More...
 
enum class  dj::ParseMode : std::int8_t { dj::Auto , dj::Strict , dj::Jsonc }
 Parse mode. More...
 

Functions

auto dj::to_string (Json const &json, SerializeOptions const &options={})
 
auto dj::make_escaped (std::string_view text) -> std::string
 Convert input text to escaped string.
 
template<GettableT Type>
void dj::from_json (Json const &json, Type &value, Type const fallback={})
 Assign JSON as value.
 
template<SettableT Type>
void dj::to_json (Json &json, Type const &value)
 Assign value to JSON.
 

Variables

constexpr auto dj::serialize_flags_v = SerializeFlag::SortKeys | SerializeFlag::TrailingNewline
 Default serialize flags.