diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-21 11:30:08 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-21 11:30:08 +0100 |
commit | 2435eef617b4234e2bd75073eb92e5186bcbcdcc (patch) | |
tree | f20c6bc5e3062c3825a89618f01956e9414339c8 /doc | |
parent | adf109d806442c392b0c81c6472a320c7ed9810c (diff) | |
parent | 1aaff63b8fd774898bf9f8bbff0f4f42920f4cca (diff) |
Merge pull request #71390 from reduz/fix-json-as-resource
Fixes to JSON as resource
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/JSON.xml | 14 |
1 files changed, 11 insertions, 3 deletions
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 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="JSON" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> +<class name="JSON" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> Helper class for creating and parsing JSON data. </brief_description> @@ -49,13 +49,21 @@ Returns an empty string if the last call to [method parse] was successful, or the error message if it failed. </description> </method> + <method name="get_parsed_text" qualifiers="const"> + <return type="String" /> + <description> + Return the text parsed by [method parse] as long as the function is instructed to keep it. + </description> + </method> <method name="parse"> <return type="int" enum="Error" /> - <param index="0" name="json_string" type="String" /> + <param index="0" name="json_text" type="String" /> + <param index="1" name="keep_text" type="bool" default="false" /> <description> - 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]). </description> </method> <method name="parse_string" qualifiers="static"> |