From 2bafcd3422bea8baf2282f5de87538a59f0bb254 Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Tue, 29 Dec 2020 18:12:33 +0000 Subject: Consolidate JSON, JSONParseResults and JSONParser into JSON Renames JSON.parse_string() to parse() Renames JSON.decode_data() to stringify() --- core/variant/variant.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'core/variant/variant.cpp') diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index 4e45862fd3..badb5ba103 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -32,6 +32,7 @@ #include "core/core_string_names.h" #include "core/debugger/engine_debugger.h" +#include "core/io/json.h" #include "core/io/marshalls.h" #include "core/io/resource.h" #include "core/math/math_funcs.h" @@ -1838,6 +1839,11 @@ String Variant::stringify(List &stack) const { return ""; } +String Variant::to_json_string() const { + JSON json; + return json.stringify(*this); +} + Variant::operator Vector2() const { if (type == VECTOR2) { return *reinterpret_cast(_data._mem); -- cgit v1.2.3