summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-09-21 00:19:52 +0200
committerGitHub <noreply@github.com>2022-09-21 00:19:52 +0200
commitb809b6d97e94d6c15760146117525398034abeb8 (patch)
tree3300372bf2c12f92e40849e589dbf42640388768 /doc
parent160e0a45b7177f8ee3e8adf8f169d18d73a2b14a (diff)
parentf225bfe28ca670c8ddfd62c436f44d35b543e0ee (diff)
Merge pull request #66120 from RedMser/json-spec-docs
Add documentation note about `JSON.parse` not being spec compliant
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/JSON.xml5
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/classes/JSON.xml b/doc/classes/JSON.xml
index 38ddca2727..125d016632 100644
--- a/doc/classes/JSON.xml
+++ b/doc/classes/JSON.xml
@@ -28,6 +28,11 @@
[codeblock]
var data = JSON.parse_string(json_string) # Returns null if parsing failed.
[/codeblock]
+ [b]Note:[/b] Both parse methods do not fully comply with the JSON specification:
+ - Trailing commas in arrays or objects are ignored, instead of causing a parser error.
+ - New line and tab characters are accepted in string literals, and are treated like their corresponding escape sequences [code]\n[/code] and [code]\t[/code].
+ - Numbers are parsed using [method String.to_float] which is generally more lax than the JSON specification.
+ - Certain errors, such as invalid Unicode sequences, do not cause a parser error. Instead, the string is cleansed and an error is logged to the console.
</description>
<tutorials>
</tutorials>