var roadLine = '@ViewBag.RoadLine';
var jsonRoadLine = JSON.parse(roadLine.replace(/"/g, '"')); //将有的"替换成"
jsonRoadLine = JsonSort(jsonRoadLine, "name");
//对json排序
function JsonSort(json, key) {
for (var j = 1, jl = json.length; j < jl; j++) {
var temp = json[j],
val = temp[key],
i = j - 1;
while (i >= 0 && json[i][key] > val) {
json[i + 1] = json[i];
i = i - 1;
}
json[i + 1] = temp;
}
return json;
}