JSON Parse Error

Discussion and help for Easy Save 3
Post Reply
coolmoedee
Posts: 1
Joined: Tue Apr 14, 2020 11:12 pm

JSON Parse Error

Post by coolmoedee »

Hi Joel

I’m hoping you can assist with a saving problem I’m encountering with Easy Save 3. Specifically, when trying to save certain data, the resulting save file fails JSON validation (using something like JSONLint) with a parse error. FYI the JSON validation error is: “expecting ‘EOF’ , ‘}’, ‘:’, ‘,’ ’, ’ ‘]’ , got ‘{‘ ”.

Unfortunately, no errors get thrown by Easy Save or by Unity when saving, so from all appearances the save system is running fine (even though, of course, it isn’t). What this means is that I can’t point you to a specific error code and so a slightly lengthy explanation is required.

To give you an idea of the data that is causing issues, I have a ‘character’ Game Object which has various components, some of which contain data to be saved. When the save system gets triggered a component on the character retrieves the relevant save information from other character components, this data is returned from the specific components as type Object.

All returned component data to be saved is placed in a Dictionary: Keys are strings, being the names of the scripts that create the components and return data, the Value is the object type data returned by that script/component. The result of this process is each character has a Dictionary of save data in the format Dictionary<string, object>. This is the point that Easy Save comes in.

If I try and save this data using Easy Save, say for example bundling all the Dictionaries into a List called characterSaveData and then saving using ES3.Save<List<Dictionary<string, object>>>(“SaveData”, characterSaveData) I encounter the above issue. Other collections behave similarly: e.g. if I bundle all the character save data into a Dictionary, using a unique ID for each character as the Keys, I get the same result.

Do you have any thoughts on what the issue may be?
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: JSON Parse Error

Post by Joel »

Hi there,

Please could you private message me the save file so I can run it through the validator and see what is happening?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply