|
nfx-serialization 0.3.0
Cross-platform C++ JSON serialization library with extensible trait capabilities
|
Templated JSON serializer with compile-time type mapping. More...
#include <nfx/serialization/json/Serializer.h>
Classes | |
| struct | Options |
| Serialization options and context. More... | |
Public Types | |
| using | value_type = T |
| The type being serialized/deserialized. | |
Public Member Functions | |
| Serializer ()=default | |
| Default constructor. | |
| Serializer (const Options &options) noexcept | |
| Constructor with options. | |
| const Options & | options () const noexcept |
| Get current serialization options. | |
| void | setOptions (const Options &options) noexcept |
| Set serialization options. | |
| Document | serialize (const T &obj) const |
| Serialize object to JSON document. | |
| T | deserialize (const Document &doc) const |
| Deserialize object from JSON document. | |
Static Public Member Functions | |
| static std::string | toString (const T &obj, const Options &options={}) |
| Serialize object to JSON string. | |
| static T | fromString (std::string_view jsonStr, const Options &options={}) |
| Deserialize object from JSON string. | |
Templated JSON serializer with compile-time type mapping.
| T | The type to serialize/deserialize |
Provides automatic serialization and deserialization of C++ objects to/from JSON using compile-time type detection and traits.
Definition at line 51 of file Serializer.h.
| using nfx::serialization::json::Serializer< T >::value_type = T |
The type being serialized/deserialized.
Definition at line 95 of file Serializer.h.
|
inlineexplicitnoexcept |
Constructor with options.
| options | Serialization options to use |

|
inline |
Deserialize object from JSON document.
| doc | The document to deserialize from |
| std::runtime_error | if deserialization fails |

|
inlinestatic |
Deserialize object from JSON string.
| T | Type of object to deserialize |
| jsonStr | JSON string to deserialize from |
| options | Serialization options (optional, uses defaults if not provided) |

|
inlinenoexcept |
Get current serialization options.

|
inline |
Serialize object to JSON document.
| obj | The object to serialize |
| std::runtime_error | if serialization fails |

|
inlinenoexcept |
Set serialization options.
| options | New options to use |


|
inlinestatic |
Serialize object to JSON string.
| T | Type of object to serialize |
| obj | Object to serialize |
| options | Serialization options (optional, uses defaults if not provided) |

