需要将如下JSON

{"a":"a","b":"b","c.e":"e","c.f":"f"}

转换为

{"a":"a","b":"b","c":{"e":"e","f":"f"} 

 

添加项目依赖

<dependency>
    <groupId>com.github.wnameless</groupId>
    <artifactId>json-flattener</artifactId>
    <version>0.6.0</version>
    <scope>test</scope>
</dependency>

 

然后一行代码搞定

String nestJson = JsonUnflattener.unflatten(json);

 

项目地址:https://github.com/FasterXML/jackson

相关文章:

  • 2021-10-27
  • 2021-10-25
  • 2022-12-23
  • 2021-12-27
  • 2022-02-08
  • 2022-12-23
  • 2022-01-06
  • 2022-01-26
猜你喜欢
  • 2021-10-09
  • 2021-12-20
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2021-10-31
  • 2022-03-05
相关资源
相似解决方案