What
String cmd = String.Format(data, id.toString(), newData);
does is: trying to format the String data , using just 2 strings..not 22!!
Which ones?...1)id.ToString() and 2)newData.ToString()
Thats obviously wrong
How you can see that this is the problem...? Leave just {0} and {1} in data string and print it.It compiles ok and see what you get.
Of course you have to use {{ instead of { where you want a string literal
Fully working Solution:
int id = 112;
String[] newData = { id.ToString(),"1", "2", "21", "reidb", "reidb", "reidb", "reidb", "aa",
"Some description", "11", "2012-02-28", "2012-01-29", "true", "1", "1",
"true", "note note note", "true", "1", "2011-12-03", "45"};
String data = "{{ cmd: \"save magellan deal\", data: {{ id: {0} , AId: {1}, " +
"CId: {2}, CCId:{3}, LA: \"{4}\", BA: \"{5}\" , " +
"LSA: \"{6}\" , BSA: \"{7}\" , \"path: \"{8}\"," +
"dscp: \"{9}\", SI: \"{10}\", CD: \"{11}\", " +
"period: \"{12}\", IsStatic: {13}, LSD: {14}, LC: {15}, RB: {16},}} " +
"Notes: \"{17}\", IsEE: {18}, RBy: {19}, DPDD: \"{20}\", LId: {21} }} }}";
String cmd = String.Format(data, newData);