The JSON format standard does not have a data type to specifically store
Vector2 values (and
Color, and poolvectors). So the information will be downgraded to something else, here a string.
You may have to parse the value manually indeed.
I usually parse JSON files manually anyways: before saving, I convert the data into a JSON-compatible dictionary and then save that ; and after loading from JSON I convert back into Godot types. Sometimes I use an automated script to format the data in and out, which works in some cases: https://github.com/Zylann/godot_texture_generator/blob/master/addons/zylann.tgen/util/jsonify.gd
Although, there is no way to differenciate an
Array and a
PoolIntArray for example since
Array can be represented in exactly the same way. Same for
float, JSON will always give you
float, since the JSON standard only has
So despite its popularity, JSON is actually quite shitty if you want to work with Godot-specific data types^^"
Another option is to use a schema, i.e a specification of the data types in what you save. This is trivial in C# since you can save a class without embedding type information, and get it back easily since the language is strongly typed. But in GDScript, typing is dynamic so you may rely on a different strategy.
get_var with the
File class should properly store Godot types, but it's a binary format.