Hi,
I'm trying to add a JSON serializer / deserializer to the java project, so that I will be able to better handle the data I retrieve from the server (most of it is stored in JSON format). I need something that works similarly to Newtonsoft.json in c#.
So far, I came across google's GSON. I downloaded the .jar file, added it to the project under "libs" folder, but whenever I try to use it, I'm getting the following error in the smartfox console:
java.lang.NoClassDefFoundError
I have no idea how to solve this, and couldn't find a solution online.
I'd appreciate it if anyone could either point me in the right direction, or suggest a different JSON library.
Thanks
Java and JSON serialization
Re: Java and JSON serialization
The best place to put your JSON library is under SFS2X/extenions/__lib__/
This is like a "shared library" folder. In other words all Extensions will be able to use the library and it gets deployed only once.
Hope it helps
p.s. = out of the box SFS2X provides a JSON library, (net.sf.json) but I am not sure if it's fully compatible with your client C# library. In any case there's no problem using Google's implementation. Just saying
This is like a "shared library" folder. In other words all Extensions will be able to use the library and it gets deployed only once.
Hope it helps
p.s. = out of the box SFS2X provides a JSON library, (net.sf.json) but I am not sure if it's fully compatible with your client C# library. In any case there's no problem using Google's implementation. Just saying
Re: Java and JSON serialization
Wow, thanks!!!
Only after reading your post did I recall that __lib__ library... I copied the .jar there, and everything worked well...
I was not aware of the JSON library provided by SFS, and it doesn't have to be compatible with my C# code, since I'm only using it to read data from the DB. If it can serialize and deserialize JSONs to and from custom classes, then it might work for me, as well...
Only after reading your post did I recall that __lib__ library... I copied the .jar there, and everything worked well...
I was not aware of the JSON library provided by SFS, and it doesn't have to be compatible with my C# code, since I'm only using it to read data from the DB. If it can serialize and deserialize JSONs to and from custom classes, then it might work for me, as well...
Re: Java and JSON serialization
I think it does, you can give it a try. In any case both solutions are good.
Who is online
Users browsing this forum: No registered users and 121 guests