irccd  3.0.3
Classes | Functions
irccd::json_util Namespace Reference

Utilities for JSON. More...

Classes

class  deserializer
 Convenient JSON object parser. More...
 
struct  type_traits
 Describe how to convert a JSON value. More...
 
struct  type_traits< bool >
 Specialization for bool. More...
 
struct  type_traits< double >
 Specialization for double. More...
 
struct  type_traits< std::int16_t >
 Specialization for std::int16_t. More...
 
struct  type_traits< std::int32_t >
 Specialization for std::int32_t. More...
 
struct  type_traits< std::int64_t >
 Specialization for std::int64_t. More...
 
struct  type_traits< std::int8_t >
 Specialization for std::int8_t. More...
 
struct  type_traits< std::string >
 Specialization for std::string. More...
 
struct  type_traits< std::uint16_t >
 Specialization for std::uint16_t. More...
 
struct  type_traits< std::uint32_t >
 Specialization for std::int32_t. More...
 
struct  type_traits< std::uint64_t >
 Specialization for std::uint64_t. More...
 
struct  type_traits< std::uint8_t >
 Specialization for std::uint8_t. More...
 

Functions

auto pretty (const nlohmann::json &value, int indent=4) -> std::string
 
auto contains (const nlohmann::json &array, const nlohmann::json &value) noexcept -> bool
 

Detailed Description

Utilities for JSON.

Function Documentation

◆ contains()

auto irccd::json_util::contains ( const nlohmann::json &  array,
const nlohmann::json &  value 
) -> bool
noexcept

Check if a JSON array contains a specific value in any order.

Parameters
arraythe JSON array
valuethe JSON value
Returns
true if value is present

◆ pretty()

auto irccd::json_util::pretty ( const nlohmann::json &  value,
int  indent = 4 
) -> std::string

Print the value as human readable.

Note
This only works on flat objects.
Parameters
valuethe value
indentthe optional indent for objects/arrays
Returns
the string