- Home /
Error: Improper JSON formatting
So I want to send an object through SocketIO as a JSON object, but unity gives an error improper JSON formatting:0.0
and sends null instead of the data from the object
The object I want to send:
[Serializable] public class Player { public string id = "0"; public Position position; }
Sending the object:
networkIdentity.GetSocket().Emit("updatePosition", new JSONObject(JsonUtility.ToJson(player)));
If anyone knows how to solve this please let me know.
Answer by Aiden76 · Oct 11, 2020 at 05:06 PM
i have exactly same problem too now ! :(((((((((((((((((((
Your answer
![](https://koobas.hobune.stream/wayback/20220613013444im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiplayer game using Sockets or Socket.IO? (without UNET or Photon) 6 Answers
JsonUtility deserialization via JSON file doesn't work on WWW, works on File.ReadAllText 1 Answer
How can i send and read a float list from server to Unity using Socket IO for Unity? 1 Answer