ESPHome  2024.11.0
Typedefs | Functions
esphome::json Namespace Reference

Typedefs

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

Functions

std::string build_json (const json_build_t &f)
 Build a JSON string with the provided json build function. More...
 
bool 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...
 

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 20 of file json_util.h.

◆ json_parse_t

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

Callback function typedef for parsing JsonObjects.

Definition at line 17 of file json_util.h.

Function Documentation

◆ build_json()

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

Build a JSON string with the provided json build function.

Definition at line 21 of file json_util.cpp.

◆ parse_json()

bool 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 65 of file json_util.cpp.