/// <summary>
/// 处理json字符串中的特殊字符
/// </summary>
/// <param name="ors"></param>
/// <returns></returns>
public static String StringDanYinToJSON(String ors)
{
ors = ors == null ? "" : ors;
StringBuilder buffer = new StringBuilder(ors);
int i = 0;
while (i < buffer.Length)
{
if (buffer[i] == ‘\‘‘ || buffer[i] == ‘\\‘)
{
buffer.Insert(i, ‘\\‘);
i += 2;
}
else
{
i++;
}
}
return buffer.ToString();
}
用上述代码在后台处理下就可以了
时间: 2024-10-27 12:58:19