Handles serialization, deserialization, and validation of Project JSON.
More...
#include <src/structure/project/project_json_serializer.h>
|
| static nlohmann::json | serialize (const Project &project, const utils::Version &app_version, std::string_view title) |
| | Returns a json representation of the project.
|
| static void | validate_json (const nlohmann::json &j) |
| | Validates JSON against the project schema.
|
| static void | deserialize (const nlohmann::json &j, Project &project) |
| | Loads and validates a project from JSON.
|
Handles serialization, deserialization, and validation of Project JSON.
This class manages converting Project objects to/from JSON format according to the project schema (data/schemas/project.schema.json), and validates JSON against that schema.
Definition at line 25 of file project_json_serializer.h.
◆ deserialize()
| void zrythm::structure::project::ProjectJsonSerializer::deserialize |
( |
const nlohmann::json & | j, |
|
|
Project & | project ) |
|
static |
Loads and validates a project from JSON.
- Parameters
-
| j | The JSON to deserialize. |
| project | The project instance to populate. |
- Exceptions
-
| std::runtime_error | on validation or load error. |
◆ serialize()
| nlohmann::json zrythm::structure::project::ProjectJsonSerializer::serialize |
( |
const Project & | project, |
|
|
const utils::Version & | app_version, |
|
|
std::string_view | title ) |
|
static |
Returns a json representation of the project.
- Parameters
-
| project | The project to serialize. |
| app_version | Version of the application. |
| title | Project title. |
- Exceptions
-
| std::runtime_error | on error. |
◆ validate_json()
| void zrythm::structure::project::ProjectJsonSerializer::validate_json |
( |
const nlohmann::json & | j | ) |
|
|
static |
Validates JSON against the project schema.
- Parameters
-
- Exceptions
-
| std::runtime_error | if validation fails. |
◆ DOCUMENT_TYPE
| auto zrythm::structure::project::ProjectJsonSerializer::DOCUMENT_TYPE = "ZrythmProject"sv |
|
staticconstexpr |
◆ kDatetimeKey
| auto zrythm::structure::project::ProjectJsonSerializer::kDatetimeKey = "datetime"sv |
|
staticconstexpr |
◆ kProjectData
| auto zrythm::structure::project::ProjectJsonSerializer::kProjectData = "projectData"sv |
|
staticconstexpr |
◆ kTitle
| auto zrythm::structure::project::ProjectJsonSerializer::kTitle = "title"sv |
|
staticconstexpr |
◆ SCHEMA_VERSION
| utils::Version zrythm::structure::project::ProjectJsonSerializer::SCHEMA_VERSION { 2, 1, {} } |
|
staticconstexpr |
The documentation for this class was generated from the following file: