如何替换Typesafe .conf文件中的值

我将我的json有效负载保存在ex的typesafe conf文件中。 testdata.conf 第1步 { testRegForm:“ {\” formId \“:1,\” testRequestId \“:133,\” valid \“:true,\” formType \“:\” demo \“,\” identifier \“:null,}” }

* Now I want to replace the value of key ```"testRequestId\"```,i.e. 133 should be replaced by my code,So I wrote below code. 

lang-java
String testDetail;
String custId = "1233";
for (Map.Entry < String,String > map: mapObj.entryset()) {
    if (map.getKey().equals("ngoRegistrationForm")) {
        testDetail = map.getvalue();
        sb.append("\"" + map.getKey() + "\":" + testDetail.replaceFirst("ngoRequestId",custId) + ",");
    }

    String jsonString = sb.toString();
    System.out.println("new payload 1 ::" + jsonString);
    OUtput: "testRegForm": {
        "formId": 1,"1233": 133,"valid": true,"formType": "NGO","identifier": null
}

但是它替换了密钥,有人可以帮忙如何替换密钥的值,即133应该被custId替换吗?

iCMS 回答:如何替换Typesafe .conf文件中的值

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2139428.html

大家都在问