SimpleJSON doesn't work
Only to me can similar problems happen: Some time ago I downloaded SimpleJSON.cs and used it with visual studio for a small project (without unity), obviously I installed the necessary package (Install-Package ICSharpCode.SharpZipLib.dll in the NuGet console) and everything worked correctly. Today I decided to use it within another project, this time a unity project, and this happened:
I tried to search online but found nothing. I'm not an experienced programmer and this script is too complex for me, I can't figure out what's wrong. Please help me.
NuGet console is not supported in Unity out of the box.
https://github.com/GlitchEnzo/NuGetForUnity
Or download the source code of your package directly if possible.
Answer by Bunny83 · Feb 05, 2021 at 06:46 PM
Well, that looks like you have a very old version of SimpleJSON. The SharpZipLib is not required at all, only when you want to use the compressed binary serialization option which was just an "experiment". When you comment out the line
#define USE_SharpZipLib
You don't need the SharpZipLib, Though of course you loose the compression function.
Note that the most recent version which has a lot of bugfixes and feature additions can be found on github. It's not split into several files. The SimpleJSON.cs file is the main file. The other files are extension files. The binary serialization is now also in a seperate extention file. There's also an extention specifically for Unity to provide easy support for reading Vectors, Quaternions, Color and some other Unity types from json.
If you really want to use the compression for the binary format, it's hard to tell what's wrong in your project. Are you sure you have the SharpZipLib in your project?
Note that the binary format does not have a version identifier. This was a huge oversight as it makes any modifications on the format difficult without breaking existing serialized data. I would not recommend to use the binary format, at least not for data storage. It may be useful for network transfer.
Thank you so much for the updated file and extensions! now everything is easier. Forgive the ignorance, I didn't know what SharpZipLib was for, I thought it was necessary to make SimpleJSON work, I don't really need it. Thanks
Hey, excuse me, I have a little problem, I'm trying to store two arrays, a bool [,] and an int [], but in both cases I get this error:
"it is not possible to implicitly convert from int[] (/ bool[, ]) to simpleJSON.JSONNode"
i searched online but all the solutions I found don't work with this library, how can i store this type of arrays? @Bunny83
Your answer
Follow this Question
Related Questions
Storing levels data 1 Answer
Problem with jsonconstructor while deserializing a class 0 Answers
JsonData to texture? 0 Answers
3D Walk animation script errors 1 Answer