I
iDecided
Guest
Hey guys, I'm running into an issue and I'm not sure if it's me or GMS2.
I'm using GMS2 and working with saving and loading to an .ini, I'm sure many of you have done this before. I have a map with nested maps and I've added them with ds_map_add_map(). When saving, I use json_encode, write it to the .ini and when I view the file BAM! it's there.
Here's an excerpt from the written ini file:
The problem comes from when I then try to read that JSON string back into my game. I noticed that json_encode writes the string out with double-quotes around the map keys. This confuses the ini_read_string function because it stores the result from json_encode() in a set of double-quotes. Thus, when I read in the string, it gets cut off prematurely.
When I read it back using ini_read_string(), I get just the first '{' and a space, because it reads the first double-quote of the first key as the end of the string.
I can see that it's writing it correctly, but I also see where it gets confused. So is this me, or is it GMS2?
I'm using GMS2 and working with saving and loading to an .ini, I'm sure many of you have done this before. I have a map with nested maps and I've added them with ds_map_add_map(). When saving, I use json_encode, write it to the .ini and when I view the file BAM! it's there.
Here's an excerpt from the written ini file:
Code:
[sd_playerstate]
affectionLevelsMap="{ "jacob": 0.000000 }"
When I read it back using ini_read_string(), I get just the first '{' and a space, because it reads the first double-quote of the first key as the end of the string.
Code:
"{ "