Java:删除映射中的引号值

Java:删除映射中的引号值,java,double-quotes,backslash,remove,Java,Double Quotes,Backslash,Remove,目前,我有以下带有getter和setter的映射 private Map<String, AttributeValue> attributeMap; .... public void setAttributeMap( Map<String, AttributeValue> attributeMap) { this.attributeMap = attributeMap; } 私有地图属性映射;

目前,我有以下带有getter和setter的映射

  private Map<String, AttributeValue> attributeMap;

      ....
public void setAttributeMap(
              Map<String, AttributeValue> attributeMap) {
        this.attributeMap = attributeMap;
      }
私有地图属性映射;
....
公共无效setAttributeMap(
地图属性(地图){
this.attributeMap=attributeMap;
}
在attributeMap中,我以字符串的形式传递了一个包含5个值的Json。例如:
[{S1:1234555,},{S2:anSk,},{S3:{marvin:“iscool”},},{S4:\“make\,},{S5:“aPk”,}]

儿子被传进来时会有额外的引语和反斜杠。 我想删除双引号和\“,但我不知道如何删除这两个


在上面的示例中,我在S3、S4和S5的映射值中找到了它。

您可以创建一个正则表达式来选择其中一个

String test = "this string has \"s and \\\"s";
System.out.println(test);
System.out.println(test.replaceAll("\\\\?\"", ""));
因此,输出为

此字符串有“s”和“s”
这个字符串有s和s


replace(“\”,”)
replace(“\ \”,”)
?replaceAll使用regexp,替换所有条目..replace()使用普通字符串,并..替换所有。是的,这些名称很愚蠢,但它就是它。@m0skit0-可能会更新您的注释。
AttributeValue
?它的
toString()内部是什么
method?@rzwitserroot是的,你是对的,我的BAD告诉我们你是如何创建属性映射的,以及你是如何生成带有双引号的输出的?