Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
project_json_serializer.h
1// SPDX-FileCopyrightText: © 2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <string_view>
7
8#include "utils/version.h"
9
10#include <nlohmann/json_fwd.hpp>
11
12namespace zrythm::structure::project
13{
14class Project;
15
16using namespace std::string_view_literals;
17
26{
27public:
28 static constexpr utils::Version SCHEMA_VERSION{ 2, 1, {} };
29 static constexpr auto DOCUMENT_TYPE = "ZrythmProject"sv;
30 static constexpr auto kProjectData = "projectData"sv;
31 static constexpr auto kDatetimeKey = "datetime"sv;
32 static constexpr auto kTitle = "title"sv;
33
42 static nlohmann::json serialize (
43 const Project &project,
44 const utils::Version &app_version,
45 std::string_view title);
46
53 static void validate_json (const nlohmann::json &j);
54
62 static void deserialize (const nlohmann::json &j, Project &project);
63};
64}
Handles serialization, deserialization, and validation of Project JSON.
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.
static nlohmann::json serialize(const Project &project, const utils::Version &app_version, std::string_view title)
Returns a json representation of the project.
Core functionality of a Zrythm project.
Definition project.h:51
Represents a semantic version with major, minor, and optional patch.
Definition version.h:29