C# String.Format格式化json字符串中包含"{" "}"报错问题

时间:2014-06-07 08:49:03   收藏:0   阅读:431
json.Append(String.Format("{\"total\":{0},\"row\":{1}}", lineCount, strJSON));直接会报错

字符串中包含{或者},则需要用{{ 来代替字符 {,用}} 代替 }

如:json.Append(String.Format("{{\"total\":{0},\"row\":{1}}}", lineCount, strJSON));

C# String.Format格式化json字符串中包含"{" "}"报错问题,布布扣,bubuko.com

原文:http://www.cnblogs.com/zhangs1986/p/3770487.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!