替换 JSON 中的转义字符 [英] Replacing escape characters from JSON

查看:15
本文介绍了替换 JSON 中的转义字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用空格替换 JSON 字符串中的"字符.我该怎么做?

I want to replace the "" character from a JSON string by a empty space. How can I do that?

推荐答案

我发现从 JSON 字符串中删除所有转义字符的最简单和最好的方法是将字符串传递到 Regex.Unescape() 方法.此方法返回一个没有转义符的新字符串,甚至删除了 等.

I have found that the easiest and best way to remove all escape characters from your JSON string, is to pass the string into Regex.Unescape() method. This method returns a new string with no ecapes, even etc, are removed.

有关详细信息,请参阅此 MSDN 文章:Regex.Unescape 方法(字符串)(系统.Text.RegularExpressions)

这篇关于替换 JSON 中的转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆