I'm trying to send an array to the server with LitJson without any success
I tryed to use the StringBuilder and the JsonWritter but the final Json string seems to be malformed ;
Code: Select all
JsonData mess = new JsonData();
mess["_cmd"] = NOTIFTYPE.SENDNEWCHAR.ToString();
StringBuilder sb = new StringBuilder();
JsonWriter W = new JsonWriter(sb);
W.WriteArrayStart();
W.Write(Name);
// Gets some data into a string array
string[] charParts = parseCharacterString(Skin);
for (int i = 0; i < charParts.Length; i++)
{
W.Write(charParts[i].ToString());
}
W.WriteArrayEnd();
mess[ENETCOM.PARAMS] = sb.ToString();
Debug.Log(mess);
this sends me the following string :
Code: Select all
{"t":"xt","b":{"c":"SENDNEWCHAR","p":{"_cmd":"SENDNEWCHAR","_Params":"[\"test\",\"male\",\"head|male_head\",\"hands|male_hands\",\"pants|male_pants-2\",\"eyes|male_eyes_marron\",\"feet|male_feet-1\",\"hair|male_hair-1\",\"top|male_top_rouge\"]"},"r":-1,"x":"UserLogin"}}
Any idea to get rid of the bad "\" and " ??