aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/experimental-features.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/experimental-features.cc')
-rw-r--r--src/libutil/experimental-features.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libutil/experimental-features.cc b/src/libutil/experimental-features.cc
index e033a4116..df37edf57 100644
--- a/src/libutil/experimental-features.cc
+++ b/src/libutil/experimental-features.cc
@@ -58,4 +58,18 @@ std::ostream & operator <<(std::ostream & str, const ExperimentalFeature & featu
return str << showExperimentalFeature(feature);
}
+void to_json(nlohmann::json& j, const ExperimentalFeature& feature) {
+ j = showExperimentalFeature(feature);
+}
+
+void from_json(const nlohmann::json& j, ExperimentalFeature& feature) {
+ const std::string input = j;
+ const auto parsed = parseExperimentalFeature(input);
+
+ if (parsed.has_value())
+ feature = *parsed;
+ else
+ throw Error("Unknown experimental feature '%s' in JSON input", input);
+}
+
}