summaryrefslogtreecommitdiff
path: root/core/io/json.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-21 11:30:08 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-21 11:30:08 +0100
commit2435eef617b4234e2bd75073eb92e5186bcbcdcc (patch)
treef20c6bc5e3062c3825a89618f01956e9414339c8 /core/io/json.h
parentadf109d806442c392b0c81c6472a320c7ed9810c (diff)
parent1aaff63b8fd774898bf9f8bbff0f4f42920f4cca (diff)
Merge pull request #71390 from reduz/fix-json-as-resource
Fixes to JSON as resource
Diffstat (limited to 'core/io/json.h')
-rw-r--r--core/io/json.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/io/json.h b/core/io/json.h
index d66a4e24a3..a21cc542fd 100644
--- a/core/io/json.h
+++ b/core/io/json.h
@@ -36,8 +36,8 @@
#include "core/io/resource_saver.h"
#include "core/variant/variant.h"
-class JSON : public RefCounted {
- GDCLASS(JSON, RefCounted);
+class JSON : public Resource {
+ GDCLASS(JSON, Resource);
enum TokenType {
TK_CURLY_BRACKET_OPEN,
@@ -65,6 +65,7 @@ class JSON : public RefCounted {
Variant value;
};
+ String text;
Variant data;
String err_str;
int err_line = 0;
@@ -83,7 +84,9 @@ protected:
static void _bind_methods();
public:
- Error parse(const String &p_json_string);
+ Error parse(const String &p_json_string, bool p_keep_text = false);
+ String get_parsed_text() const;
+
static String stringify(const Variant &p_var, const String &p_indent = "", bool p_sort_keys = true, bool p_full_precision = false);
static Variant parse_string(const String &p_json_string);