ESPHome  2021.11.4
Data Structures | Typedefs | Functions | Variables
esphome::json Namespace Reference

Data Structures

class  VectorJsonBuffer
 

Typedefs

using json_parse_t = std::function< void(JsonObject &)>
 Callback function typedef for parsing JsonObjects. More...
 
using json_build_t = std::function< void(JsonObject &)>
 Callback function typedef for building JsonObjects. More...
 

Functions

const char * build_json (const json_build_t &f, size_t *length)
 Build a JSON string with the provided json build function. More...
 
void parse_json (const std::string &data, const json_parse_t &f)
 Parse a JSON string and run the provided json parse function if it's valid. More...
 
std::string build_json (const json_build_t &f)
 

Variables

VectorJsonBuffer global_json_buffer
 

Typedef Documentation

◆ json_build_t

using esphome::json::json_build_t = typedef std::function<void(JsonObject &)>

Callback function typedef for building JsonObjects.

Definition at line 17 of file json_util.h.

◆ json_parse_t

using esphome::json::json_parse_t = typedef std::function<void(JsonObject &)>

Callback function typedef for parsing JsonObjects.

Definition at line 14 of file json_util.h.

Function Documentation

◆ build_json() [1/2]

const char * esphome::json::build_json ( const json_build_t f,
size_t *  length 
)

Build a JSON string with the provided json build function.

Definition at line 13 of file json_util.cpp.

◆ build_json() [2/2]

std::string esphome::json::build_json ( const json_build_t f)

Definition at line 48 of file json_util.cpp.

◆ parse_json()

void esphome::json::parse_json ( const std::string &  data,
const json_parse_t f 
)

Parse a JSON string and run the provided json parse function if it's valid.

Definition at line 37 of file json_util.cpp.

Variable Documentation

◆ global_json_buffer

VectorJsonBuffer esphome::json::global_json_buffer

Definition at line 114 of file json_util.cpp.