我有一张地图
Map<Object, Map<String, Object>> salesReportForSoldPropertyMap= salesReportForSoldProperty.stream().collect(Collectors.toMap(tags -> tags.get("E"), Function.identity()));
当我将 Map 转换为 JSON 时,我得到了这个
{
"Sold Promissory Buyer":
{
"A": 2616100,
"B": 2616100,
"C": 31,
"D": "Sold Promissory Buyer"
},
"Auction":
{
"A": 101322143.24,
"B": 50243301.2,
"C": 569,
"D": "Auction"
},
"Sold Third Party":
{
"A": 72000,
"B": 93900,
"C": 1,
"D": "Sold Third Party"
}
}
但是在这里我有一个问题,我不想要 JSON 键中的空格和“-”。那么我们可以通过 JAVA Stream API 解决它,所以它会给我地图的密钥,没有空格和'-'?像键“Sold Third Party”应该是“SoldThirdParty”