From 1aaff63b8fd774898bf9f8bbff0f4f42920f4cca Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 14 Jan 2023 12:57:28 +0100 Subject: Fixes to JSON as resource * It was not a resource, hence it was not working to load it as such. * Changed so, when opened in editor, a parse error will not fail load and the text will be kept. * This should allow proper editing from within the code editor, including syntax checking and saving files as-is in text. Partially addresses #66820. The code editor still needs to be changed for this to work. --- doc/classes/JSON.xml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/classes/JSON.xml b/doc/classes/JSON.xml index 93731cf553..6fe53dfaac 100644 --- a/doc/classes/JSON.xml +++ b/doc/classes/JSON.xml @@ -1,5 +1,5 @@ - + Helper class for creating and parsing JSON data. @@ -49,13 +49,21 @@ Returns an empty string if the last call to [method parse] was successful, or the error message if it failed. + + + + Return the text parsed by [method parse] as long as the function is instructed to keep it. + + - + + - Attempts to parse the [param json_string] provided. + Attempts to parse the [param json_text] provided. Returns an [enum Error]. If the parse was successful, it returns [constant OK] and the result can be retrieved using [member data]. If unsuccessful, use [method get_error_line] and [method get_error_message] for identifying the source of the failure. Non-static variant of [method parse_string], if you want custom error handling. + The optional [param keep_text] argument instructs the parser to keep a copy of the original text. This text can be obtained later by using the [method get_parsed_text] function and is used when saving the resource (instead of generating new text from [member data]). -- cgit v1.2.3