如何将String转换为JsonNode

问题描述 投票:0回答:1

我正在尝试转换此属性:

private String templateData;

存储在数据库中:

private JsonNode templateData;

,但我的字符串看起来像这样:firstName,lastName,我需要它看起来像:

"firstName": "Josh",
"lastName": "Doe"

当 Josh 和 Doe 作为参数从用户传递时,如下所示:

private String firstName
private String lastName
java spring type-conversion mapper
1个回答
0
投票

您可以尝试使用类型映射。查看这篇文章来自 baeldung

© www.soinside.com 2019 - 2024. All rights reserved.