这个很棒的codebeautify几乎有我需要的东西,但不会转义特殊字符并使用单引号。对 JavaScript 来说似乎没问题。
有什么工具可以将 JSON 有效负载 a 转换为多行转义的 Java 字符串?
我想制作这样的东西:
"{\r\n" +
"\"AttributeLogicalName\": \"entityLogicalname\",\r\n" +
"\"EntityLogicalName\": \"entity\",\r\n" +
"\"Value\": \"100000002\",\r\n" +
"\"Label\": {\r\n" +
"\"LocalizedLabels\": [\r\n" +
"{\r\n" +
"\"Label\": \"nerd\",\r\n" +
"\"LanguageCode\": 1033,\r\n" +
"\"IsManaged\": false,\r\n" +
"\"MetadataId\": \"881daca2-5c68-e911-a825-000d3a1d501d\",\r\n" +
"\"HasChanged\": null\r\n" +
"}\r\n" +
"],\r\n" +
但是codebeautify只会产生这个。
' { ' +
' "AttributeLogicalName": "new_localoptionsettoform", ' +
' "EntityLogicalName": "cr965_testcdsentity", ' +
' "Value": "100000002", ' +
' "Label": { ' +
' "LocalizedLabels": [ ' +
' { ' +
' "Label": "nerd", ' +
' "LanguageCode": 1033, ' +
' "IsManaged": false, ' +
' "MetadataId": "881daca2-5c68-e911-a825-000d3a1d501d", ' +
' "HasChanged": null ' +
' } ' +
' ], ' +