-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data partially lost when iterating through a deserialized Dictionary #95445
Comments
I tested this by converting a However, not all is lost. The data is still there and it can be retrieved you would just need to parse it yourself. My recommendation is to break down each of the Godot types like On a separate note, if you're using C#, it may be preferable to avoid |
Thanks for that explanation. What is not clear to me now is whether I should close this bug report (considering that I was misusing this API), or if it should still be considered a bug considering that the godot documentation for json says:
and does not mention any such limitation. |
As explained by @atlasapplications, Godot's JSON serializer only supports JSON data types (string, number, object, array, bool, and null). There's already a proposal to add support for all Godot engine types: I can see how the JSON documentation could be misleading, although later in the documentation it seems to vaguely mention some of these limitations. Pull requests to improve the documentation are welcomed 🙂 |
Thanks for this feedback. |
Tested versions
v4.2.2.stable.mono.official [15073af]
System information
Windows 11
Issue description
I create a
Godot.Collection.Dictionary<Vector2I, Vector2I>
, fill it with some values, and serialize it (withJson.Stringify
). So far so good.I then deserialize it with
json.Parse
and cast it back to aGodot.Collection.Dictionary<Vector2I, Vector2I>
.At this point calling
.ToString()
on this deserialized value shows the expected content. But looping (with aforeach
) on this variable get me key and values that are allVector2I.Zero
Steps to reproduce
Run the following code (which is pretty much the code from the Saving games documentation page):
The expected behavior is that the last line of this code prints
(1, 2) -> (3, 4)
, but the actual behavior is that it displays(0, 0) -> (0, 0)
.Minimal reproduction project (MRP)
clone.zip
The text was updated successfully, but these errors were encountered: