Simple implementation of Java Json conversion entity class object

1. In the process of development, there are often too many tables that are directly dependent on Josn to transfer values. In some scenarios, Json needs to be converted to entity classes. Here is the most concise method that depends on Ali's FastJSon

maven introduction

    <groupId>com.alibaba</groupId>
    <artifactId>fastjson</artifactId>
    <version>1.2.54</version>
</dependency>

Class introduction

import com.alibaba.fastjson.JSON;

Conversion method

IdCardImageDto imageEntity=JSON.parseObject(JSON.parse(ossImage).toString(),IdCardImageDto.class);

Finish work

Guess you like

Origin blog.csdn.net/qq_23140197/article/details/106355224