I have found that when I send a Json throught the extension longer than 1000 chars (more or less), the Json is not arriving giving this error:
"Error deserializing request: net.sf.json.JSONException: Found starting '{' but missing '}' at the end. at character 0 of null"
Maybe (just maybe) there is a limit on the lenght.
If so, where can I modify it?
If not, what is happening?
Thank you.
Json lenght limit
Re: Json lenght limit
Hi,
the limit for a String is 32KB, so 1000 characters doesn't pose any problem.
Maybe you're sending JSON with strange characters in it? Maybe a problem with quotes inside a String in the JSON structure?
I am not sure if this is a problem but I seem to remember a case where a developer was sending JSON inside JSON and that was causing a deserialization issue...
Do you have an example of the JSON object that you're sending and that causes this error?
Also can you specify which client platform you use (and version)?
Thanks
the limit for a String is 32KB, so 1000 characters doesn't pose any problem.
Maybe you're sending JSON with strange characters in it? Maybe a problem with quotes inside a String in the JSON structure?
I am not sure if this is a problem but I seem to remember a case where a developer was sending JSON inside JSON and that was causing a deserialization issue...
Do you have an example of the JSON object that you're sending and that causes this error?
Also can you specify which client platform you use (and version)?
Thanks
Re: Json lenght limit
Code: Select all
{"M":{"mp":[],"p0":3,"p1":4,"p2":0,"p3":0,"c":"55","ipl":0,"d":4,"e":5,"f":[0,0],"g":[-1,1,-1,-1,0,-1,-1,0,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,-1,0,-1,-1],"h":[0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,3,0,0],"i":[0,-3,0,0,0,0,0,0,0,0,1,0,0,0,-2,0,0,1,0,-1,0,0,0,2,0,0,0,0],"j":[494,559,646,733,798,864,930],"k":[367,371,371,371,371,371,392],"j1":[0,22,22,-22,0,-22,0],"k1":[24,2,2,2,-18,2,-18],"j2":[0,-22,-22,22,0,22,0],"k2":[-18,2,2,2,24,2,24],"l":[true,false,false,false,true,false,true],"m":["55","45","04","01","11","14","44"],"n":0,"ro":1,"mr2":["36","04","14","25","05","23","56"],"mr3":["33","11","56","25","46","12","16"],"mr4":["05","55","12","35","14","02","45"],"mr5":["15","00","04","34","26","03","36"],"mr6":["12","44","11","45","56","05","14"],"mr7":["05","24","22","04","46","25","14"],"mr8":["35","33","25","11","13","36","22"],"mr9":["56","34","45","15","33","66","25"],"B":"pirim"},"L":{"p":"24","s":1,"i":1,"T":"m","I":8,"AS":false},"R":"pim"}
This is the exact json and it is 982 chars long.
It is not a Json within a Json, it's simple Json with strings and ints.
It works on http://json.parser.online.fr/ too.
Re: Json lenght limit
Thanks, can you also answer the other questions in my last post?
In particular it is not clear if you're sending from the server side and you get the error at the server too? The error says "Error deserializing" so I take it that the data is sent from client side?
Can you also show the code that sends the data?
Thanks
In particular it is not clear if you're sending from the server side and you get the error at the server too? The error says "Error deserializing" so I take it that the data is sent from client side?
Can you also show the code that sends the data?
Thanks
Re: Json lenght limit
You are right, sorry.
I send it from client to server and then to a client, ie, from client to client but throught the server.
I am using WebGL. Last tests were WebGl vs Unity Editor (in WebGL mode), but I am almost sure webgl vs webgl is the same. I could try also Android if you need or any other combination. It's turn-based game.
The error appears on the server, on the View Log in the Admin zone. I am not sure if it's when it receives it or when it sends it again to the other player. I also edit this Object on the zone extension, since basically this JSON represents the ISFSObject as on any package.
About the code, it's a standard package sent to the zone extension. Tomorrow I will be able to send you the exact code.
Thank you.
I send it from client to server and then to a client, ie, from client to client but throught the server.
I am using WebGL. Last tests were WebGl vs Unity Editor (in WebGL mode), but I am almost sure webgl vs webgl is the same. I could try also Android if you need or any other combination. It's turn-based game.
The error appears on the server, on the View Log in the Admin zone. I am not sure if it's when it receives it or when it sends it again to the other player. I also edit this Object on the zone extension, since basically this JSON represents the ISFSObject as on any package.
About the code, it's a standard package sent to the zone extension. Tomorrow I will be able to send you the exact code.
Thank you.
Re: Json lenght limit
Another important data:
When I send a very similar json but smaller, it arrives properly. Below 900 chars (almost the very same string) there is no problem.
Just when the json is longer it is when this error comes.
Maybe this helps.
The json goes longer because it represents a match with pieces. When there are many pieces, the json exceeds 1000 chars and appears the error.
When I send a very similar json but smaller, it arrives properly. Below 900 chars (almost the very same string) there is no problem.
Just when the json is longer it is when this error comes.
Maybe this helps.
The json goes longer because it represents a match with pieces. When there are many pieces, the json exceeds 1000 chars and appears the error.
Re: Json lenght limit
One more data: On mobile Android is working well. It seems the problem to happen on Webgl.
I am almost sure the json is cut. At some place in webgl the json is cut.
I am almost sure the json is cut. At some place in webgl the json is cut.
Re: Json lenght limit
We believe the issue is related to a limit set in a library used by our API for websocket communication in the Unity Editor only, and when set to build for WebGL only.
In fact if you build your project and run it in the browser, everything should work fine.
In any case we can send you an updated API package with that limit largely increased. Please contact us by email referencing this topic.
In fact if you build your project and run it in the browser, everything should work fine.
In any case we can send you an updated API package with that limit largely increased. Please contact us by email referencing this topic.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: Json lenght limit
Yes, it seems it's exactly that.
It works webgl vs webgl, but not webgl vs Unity Editor in webgl.
I'm sending you that email.
It works webgl vs webgl, but not webgl vs Unity Editor in webgl.
I'm sending you that email.
Re: Json lenght limit
Hello,
We are facing the same problem with the smartfox version 2.6 and Unity 5.3.3f1.
Is there a solution from unity Editor to unity Editor ? Or is it by mail that you send the correction?
Thanks for reply.
We are facing the same problem with the smartfox version 2.6 and Unity 5.3.3f1.
Is there a solution from unity Editor to unity Editor ? Or is it by mail that you send the correction?
Thanks for reply.
Re: Json lenght limit
This was fixed in C# API v1.6.3 we released 1 year ago (more or less).
Please update your project to the latest API version.
Please update your project to the latest API version.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: Json lenght limit
thanks for reply, its works fine !
Who is online
Users browsing this forum: Google [Bot] and 104 guests