FormatException: Expected '{' or "null", found '0'. ES3Internal.ES3JSONReader.ReadNullOrCharIgnoreWhitespace (System.Cha

Discussion and help for Easy Save 3
Post Reply
GatheringStormStudio
Posts: 5
Joined: Sat Nov 28, 2020 7:29 pm

FormatException: Expected '{' or "null", found '0'. ES3Internal.ES3JSONReader.ReadNullOrCharIgnoreWhitespace (System.Cha

Post by GatheringStormStudio »

I have been using Easy Save for the past couple of months. Overall it's been an ok experience. However, I have had a massive error within the last 24 hours. So I have been saving scriptable objects as .byte files. Up until now I haven't had many issues. I have released several patches where people can move saves across for our alpha. It's worked every time (minus some errors from my side). However, the last patch I never changed the saving/loading code manager. But now it is throwing this error.
FormatException: Expected '{' or "null", found '0'.
ES3Internal.ES3JSONReader.ReadNullOrCharIgnoreWhitespace (System.Char expectedChar)
I have traced it to this line (worked in all previous patches till now) ScriptableObject Item = ES3.Load<ScriptableObject>("Item", File);
There is nothing wrong with the encryption password as I have not changed that.
User avatar
Joel
Moodkie Staff
Posts: 4852
Joined: Wed Nov 07, 2012 10:32 pm

Re: FormatException: Expected '{' or "null", found '0'. ES3Internal.ES3JSONReader.ReadNullOrCharIgnoreWhitespace (System

Post by Joel »

Hi there,

You should provide the type of the ScriptableObject to the ES3.Load method. I.e. ES3.Load<MyType> rather than ES3.Load<MyScriptableObject>.

If this doesn't resolve your issue, please could you send over the ScriptableObject you are saving, and also your save file (found in Window > Easy Save 3 > Tools > Open Persistent Data Path).

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
GatheringStormStudio
Posts: 5
Joined: Sat Nov 28, 2020 7:29 pm

Re: FormatException: Expected '{' or "null", found '0'. ES3Internal.ES3JSONReader.ReadNullOrCharIgnoreWhitespace (System

Post by GatheringStormStudio »

Thanks, I will look into that fix. However, it was originally a specific SO type which didn't work then I put into a universal SO type then cast it. But I will try that and get back to you thank you!
User avatar
Joel
Moodkie Staff
Posts: 4852
Joined: Wed Nov 07, 2012 10:32 pm

Re: FormatException: Expected '{' or "null", found '0'. ES3Internal.ES3JSONReader.ReadNullOrCharIgnoreWhitespace (System

Post by Joel »

If that and deleting your save data doesn't resolve your issue, if you could create a new project with a basic scene which replicates it I'll be happy to look into it further.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
GatheringStormStudio
Posts: 5
Joined: Sat Nov 28, 2020 7:29 pm

Re: FormatException: Expected '{' or "null", found '0'. ES3Internal.ES3JSONReader.ReadNullOrCharIgnoreWhitespace (System

Post by GatheringStormStudio »

Ok, so converting it from the base scriptableobject to a specific didn't fix it as the save files have been saved as the base scriptable object error shown below:
InvalidOperationException: Trying to load data of type BaseItem, but data contained in file is type of UnityEngine.ScriptableObject
However, there is no files within the persistence data directory. Overall this was an unforeseen issue as I have been using this system and adding new items and so on for the last 2 months without issues till now.

Also side note to consider. Without changing the code in any shape or form. We are able to start a new save for the game and continue playing from there. However, some of our earlier players have limited edition items from halloween and so on. So also then checked the old items in the saving system with a new save and they saved fine. I'll send over the items we are saving. However they are encrypted with AES the temp password is : password. Also is a screenshot of the persistent data path
Attachments
Capture.PNG
Capture.PNG (3.43 KiB) Viewed 1394 times
GameSaves.zip
(1.32 MiB) Downloaded 99 times
User avatar
Joel
Moodkie Staff
Posts: 4852
Joined: Wed Nov 07, 2012 10:32 pm

Re: FormatException: Expected '{' or "null", found '0'. ES3Internal.ES3JSONReader.ReadNullOrCharIgnoreWhitespace (System

Post by Joel »

Hi there,

The error message you're getting is likely because you've saved it using ScriptableObject as the generic parameter. You would need to delete the save data you've created where you've used ScriptableObject as the generic parameter.

Unfortunately I wouldn't be able to determine the issue from the save files. Please could you send me a very basic project which replicates your issue?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
GatheringStormStudio
Posts: 5
Joined: Sat Nov 28, 2020 7:29 pm

Re: FormatException: Expected '{' or "null", found '0'. ES3Internal.ES3JSONReader.ReadNullOrCharIgnoreWhitespace (System

Post by GatheringStormStudio »

Hello Joel,

As to your last statement, I am slightly confused. The generic parameter would of caused an issue months ago if that was the case. We are saving and loading as a scriptableobject (generic) then when we load it we cast it as a specified type. This has worked on public builds for months. It's only since the last patch that it decided that there was an error. However, it works with a fresh save. So we have resorted to manually creating new saves for our supporters. Which was last resort. So I have no idea how you are coming to the conclusion that it's the generic parameter that is the issue if it hasn't caused an error till now.
User avatar
Joel
Moodkie Staff
Posts: 4852
Joined: Wed Nov 07, 2012 10:32 pm

Re: FormatException: Expected '{' or "null", found '0'. ES3Internal.ES3JSONReader.ReadNullOrCharIgnoreWhitespace (System

Post by Joel »

Hi there,

Just to clarify, my message was about this error message (which differs from your original error message, which is the longer term one):
InvalidOperationException: Trying to load data of type BaseItem, but data contained in file is type of UnityEngine.ScriptableObject
This is absolutely caused by the mismatch of generic parameters and cannot be caused by anything else :)

Regarding your original error message. I.e.:
FormatException: Expected '{' or "null", found '0'.
ES3Internal.ES3JSONReader.ReadNullOrCharIgnoreWhitespace (System.Char expectedChar)
As mentioned, I would need to see a basic project which replicates it to draw any conclusions about this.

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