ESPHome  2024.4.1
json_util.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
5 #include "esphome/core/helpers.h"
6 
7 #define ARDUINOJSON_ENABLE_STD_STRING 1 // NOLINT
8 
9 #define ARDUINOJSON_USE_LONG_LONG 1 // NOLINT
10 
11 #include <ArduinoJson.h>
12 
13 namespace esphome {
14 namespace json {
15 
17 using json_parse_t = std::function<void(JsonObject)>;
18 
20 using json_build_t = std::function<void(JsonObject)>;
21 
23 std::string build_json(const json_build_t &f);
24 
26 void parse_json(const std::string &data, const json_parse_t &f);
27 
28 } // namespace json
29 } // namespace esphome
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&#39;s valid.
Definition: json_util.cpp:65
std::function< void(JsonObject)> json_build_t
Callback function typedef for building JsonObjects.
Definition: json_util.h:20
std::string build_json(const json_build_t &f)
Build a JSON string with the provided json build function.
Definition: json_util.cpp:21
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
std::function< void(JsonObject)> json_parse_t
Callback function typedef for parsing JsonObjects.
Definition: json_util.h:17