ESPHome 2025.5.0
Loading...
Searching...
No Matches
json_util.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
6
7#define ARDUINOJSON_ENABLE_STD_STRING 1 // NOLINT
8
9#define ARDUINOJSON_USE_LONG_LONG 1 // NOLINT
10
11#include <ArduinoJson.h>
12
13namespace esphome {
14namespace json {
15
17using json_parse_t = std::function<bool(JsonObject)>;
18
20using json_build_t = std::function<void(JsonObject)>;
21
23std::string build_json(const json_build_t &f);
24
26bool parse_json(const std::string &data, const json_parse_t &f);
27
28} // namespace json
29} // namespace esphome
std::function< void(JsonObject)> json_build_t
Callback function typedef for building JsonObjects.
Definition json_util.h:20
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.
Definition json_util.cpp:47
std::string build_json(const json_build_t &f)
Build a JSON string with the provided json build function.
Definition json_util.cpp:12
std::function< bool(JsonObject)> json_parse_t
Callback function typedef for parsing JsonObjects.
Definition json_util.h:17
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7