private String TranslateRtRs(RouteResult RtRs) { String price = RtRs.getPrice().ToString(); String Len = RtRs.getLength().ToString(); String NodesCoords = RtRs.getNodesCoords(); String AllCoords = RtRs.getAllCoords(); String NodesId = RtRs.getNodesJiao(); String AllRtName = RtRs.getAllRtName(); String AllStaName = RtRs.getAllNodesName(); string AllRtId = RtRs.getRoutesStr(); string[] stationscoords = NodesCoords.Split(";".ToCharArray()); string[] stationsids = NodesId.Split(";".ToCharArray()); string[] stationsnames = AllStaName.Split(";".ToCharArray()); string[] stations = new string[stationsids.Length]; string stationsFormater = "{{'NAME':'{0}','ID':'{1}','COORDS':'Point({2})'}}"; for (int i = 0; i < stations.Length; i++) { stations[i] = string.Format(stationsFormater, stationsnames[i], stationsids[i], stationscoords[i].Replace(",", " ")); } string[] linesids = AllRtId.Split(";".ToCharArray()); string[] linesnames = AllRtName.Split(";".ToCharArray()); string[] lines = new string[linesids.Length]; string linesFormater = "{{'NAME':'{0}','ID':'{1}'}}"; for (int i = 0; i < lines.Length; i++) { lines[i] = string.Format(linesFormater, linesnames[i], linesids[i]); } AllCoords = AllCoords.Replace(",", " "); AllCoords = AllCoords.Replace(";", ","); string formater = "{{'PRICE':'{0}','LENGTH':'{1}','STATIONS':[{2}],'ALLCOORDS':'LINESTRING({3})','LINES':[{4}]}}"; string result = string.Format(formater, price, Len, string.Join(",", stations), AllCoords, string.Join(",", lines)); return(result); //return price + ":" + Len + ":" + NodesCoords + ":" + AllCoords + ":" // + NodesId + ":" + AllRtName + ":" + AllStaName; }