JSON Parse: Quotation marks seems to be messed up.

0 votes

Hi! Sometimes I've got this error when receiving a chat message (before the onChatReceived fires, so I can't print it)

Unhandled Exception:

System.Exception: JSON Parse: Quotation marks seems to be messed up.

  at SimpleJSON.JSONNode.Parse (System.String aJSON) [0x00000] in <filename unknown>:0 

  at SimpleJSON.JSON.Parse (System.String aJSON) [0x00000] in <filename unknown>:0 

  at com.shephertz.app42.gaming.multiplayer.client.WarpClient.OnNotify (com.shephertz.app42.gaming.multiplayer.client.message.WarpNotifyMessage msg) [0x00000] in <filename unknown>:0 

  at com.shephertz.app42.gaming.multiplayer.client.ClientChannel.handleReceivedBuffer (System.Net.Sockets.SocketAsyncEventArgs e) [0x00000] in <filename unknown>:0 

  at com.shephertz.app42.gaming.multiplayer.client.ClientChannel.<Receive>m__2 (System.Object s, System.Net.Sockets.SocketAsyncEventArgs e) [0x00000] in <filename unknown>:0 

  at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted (System.Net.Sockets.SocketAsyncEventArgs e) [0x00000] in <filename unknown>:0 

  at System.Net.Sockets.SocketAsyncEventArgs.ReceiveCallback (IAsyncResult ares) [0x00000] in <filename unknown>:0 

  at System.Net.Sockets.SocketAsyncEventArgs.DispatcherCB (IAsyncResult ares) [0x00000] in <filename unknown>:0 

The message sent is a simple string, without special characters or something. Every time the crash is coming from a different message, and all the messages are generated with the same function. Also, if I print the message before send it, it is fine.

What can it be? I've got this error in iOS, Android and mono too

asked May 20, 2014 in AppWarp by service (10 points)

1 Answer

0 votes

According to your logs, it looks like you are sending a message which is not properly formatted.

Please share the message that you are sending.

answered May 20, 2014 by Suyash Mohan (900 points)
I'm sending lots of different messages and all of them works 99 times out of 100
They are serialized with ProtoBuf and they are base64 strings, so they can't contain forbidden characters.
They look like


and so on

These messages are standard, so the same message will be encoded in the same way, so I don't see why sometimes they work and sometimes not.

I'm gonna continue testing and look to every message passed to see if the one that launch the exception looks like it should, but I'm pretty sure it will (if not, it's a protobuf issue I guess)

EDIT: The error came up again, and the server sent the message "wgKLAQojCgZwVHlBY3QSGdICFgoUUmVuZGVyYWJsZUdhbWVBY3Rpb24KIwoEcEFjdBIbwgIYChYKC1JHQV9QUGFyYW1zEgf6AgQICQgBCh8KB01OUl9yRUkSFNICEQoPR2FtZUFjdGlvbkV2ZW50Ch4KFU5ldHdvcmtNZXNzYWdlQ29tcGxleBIF8gICCAE=" that I could correctly decode from base64 to the ProtoBuf serialized string to the correct object
Is your string having those quotation marks in the starting. Because according to the logs, Quotation marks seems to be messed up
No! It hasn't quotation mark at the sending, and I can't print it after being received because of the crash before the event fire, the quotation in my answer were only there to delimit the string here
Can you share your code snippet, only then we would be able to debug your problem. You are using Unity. Right?
Yes, I'm using Unity3d.

I'm only doing this:
- Create my object to be sent
- Serialize that object with ProtoBuf
- Send it with SendChat

The problem is that the ProtoBuf serialization return me a Base64 string and it can't contain quotation marks inside, it's impossible.

If my packet was wrong, the error would be in my deserialize function, not inside appwarp, wouldn't it?

Does appwarp encode and decode the message under the hood while sending it?
We have our own custom protocol to send and receive messages. We also encode and decode JSON messages internally. Somehow JSON throws an error when it decodes the message sent by you.

What result due receive in onSendChatDone() listener when sending chat. Also since you are using Unity you can try debugging your game with mono develop and give us more technical details about the error.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com