I am working on a mobile app where I need to send objects back and forth to a central server. Each object has around 10 attributes (either strings or ints).
When I want to send an object from the app to the server I make a POST where each attribute becomes a key-value pair.
When I want to get an object from the server to the app I simply reply to a POST request with the object’s attributes on a concatenated string (e.g., atribute1;atribute2;atribute3;atribute4;atribute5;etc.) and then I parse that data on the app by splitting the string and re-creating the object.
Question: Is it fine to use this method instead of formatting the strings as JSON or XML? I opted for this because of the simplicity, and I also believe I won’t lose any performance (in fact I might gain some). But I wanted to cross check to be sure.
Here is an interesting site showing the performance difference between splitting strings and parsing json. I feel that if you’ve already got a system set up for sending data, you should be fine to stick with it.
http://jsperf.com/json-parse-vs-string-split/4
As for other dev’s JSON is a great and simple simple standard to stick with.