Using PyZMQ to set up a Socket connection.
The server is responding with a JSON Object which is converted to a String before sending using the Python json.dumps() method
My question is should the JSON Object be converted to a String BEFORE sending it to the client or left as a JSON Object?
Right now I am receiving
"{\"timestamp\": 1233456,\"foo\": 2,\"nofoo\": 0,\"foo_count\": 234,\"nofoo_count\": 12}"
which makes it difficult to parse.
At some point it has to be converted to a string before going over the network. That’s the process of serialization. you take data in memory which is kind of all over the place because object references are pointers to various memory addresses that could be millions or billions of bytes apart in RAM, and you serialize it, meaning “put it in order”, or “arrange it in series”. That turns it into the nice compact string of characters that you shared in your OP. That’s the only reasonable way to send data over the network.
To convert that serialized string back into an object graph you need to deserialize it. Look into Unity Json Deserialization. You shouldn’t be trying to manually parse JSON, that’s what JSON libraries are for. Unity has a built in JsonUtility, which is limited but will work for simple cases and can handle both serialization and deserialization.