Fix json.* constants to keep a GSON representation #4247
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Identify the Bug or Feature request
Fixes #4161
Description of the Change
When looking up a variable (including constants), we preserve
JsonArray
andJsonObject
values rather than converting them strings. The same functionality is now extended toJsonNull
and booleanJsonPrimitive
.I could have altered the checks to a single
JsonElement
, but I'm not confident whether changing other primitive JSON values (numbers) could cause issues. So instead I have chosen to be more precise and only accomodate the needs ofjson.null
,json.true
, andjson.false
, leaving the behaviour of JSON numbers to be unchanged.No other changes have been made to functions or MTScript-JSON conversion, notably:
json.get()
and similar functions will still convert returnednull
,true
, orfalse
to the MTScript strings"null"
,"true"
, and"false"
."null"
,"true"
,"false"
will not be converted to JSONnull
,true
, orfalse
when used in places that JSON is expected.Possible Drawbacks
Anyone relying on
json.*
constants being strings will need to update their code.Documentation Notes
I believe the wiki should already match the new behaviour, but just in case:
Release Notes
json.null
,json.true
, andjson.false
so that they are real JSON values rather than strings.This change is