|
FastLED 3.10.8
|
FastLED's Elegant JSON Library: fl::json
The fl::json library provides a lightweight, type-safe, and highly ergonomic interface for both parsing and generating JSON data within the FastLED ecosystem.
json["key"]["nested_key"] or json["array_key"][index].operator|): The cornerstone of robust parsing. Safely extract values with a fallback, preventing crashes from missing keys or type mismatches: int value = json["path"]["to"]["key"] | 123;fl::optional<T> for explicit handling of potential absence or type errors, ensuring predictable behavior.fl::json::object() and fl::json::array().Parse a JSON string and extract values with graceful defaults.
Construct complex JSON objects and arrays programmatically.
json object can represent JSON null or be completely uninitialized. Use is_null() to explicitly check for JSON null values.fl::json uses fl::shared_ptr internally, enabling efficient copying and avoiding manual memory management pitfalls.fl::optional values that can be safely queried or defaulted using operator|.fl::json is not inherently thread-safe. If you need to share JSON data across threads, ensure proper synchronization using mutexes or similar mechanisms.
Definition in file json.h.
#include "fl/stl/json/types.h"#include "fl/stl/bit_cast.h"#include "fl/stl/noexcept.h"#include "fl/stl/static_assert.h"
Include dependency graph for json.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Namespaces | |
| namespace | fl |
| Base definition for an LED controller. | |
| namespace | fl::detail |
Compile-time linker keep-alive hook for a single fl::Bus. | |
Functions | |
| template<typename FP> | |
| float | fl::detail::fixed_point_to_float (FP value) FL_NO_EXCEPT |
| bool | fl::detail::fixed_raw_from_ieee754_bits (u32 bits, int frac_bits, i64 *out) FL_NO_EXCEPT |
| u32 | fl::detail::ieee754_bits_from_fixed_raw (i64 raw, int frac_bits) FL_NO_EXCEPT |
| u32 | fl::detail::ieee754_bits_from_scaled_u64 (u32 sign, u64 magnitude, int binary_exp) FL_NO_EXCEPT |
| u32 | fl::detail::round_shift_right_u64 (u64 value, int shift) FL_NO_EXCEPT |
Variables | |
| volatile size_t | fl::g_json_max_stack_depth |
| volatile size_t | fl::g_json_stack_base |