본문 바로가기
카테고리 없음

[JAVA] JSON 을 이용한 data class 생성 예제 입니다. (jsonschema2pojo)

by Hwoarang757 2025. 2. 8.

JSON 을 이용한 data class 생성 예제 입니다.

 

참조 사이트 : https://www.jsonschema2pojo.org/

 

jsonschema2pojo

Reference properties For each property present in the 'properties' definition, we add a property to a given Java class according to the JavaBeans spec. A private field is added to the parent class, along with accompanying accessor methods (getter and sette

www.jsonschema2pojo.org

 

(1). data class를 생성할 JSON data를 조회 합니다. ex) 

 

(2). 위의 jsonschema2pojo.org 사이트에 접속 한 후 JSON Value를 붙여 넣습니다.

Source type : JSON 

Annotation style은 생성하고자 하는 data class의 유형을 선택 해주시면 됩니다.

그 아래 부분은 필요 사항에 따라 체크 하거나 , 해지 합니다.

 

 

(3) Preview 버튼을 클릭하여 생성 된 class를 확인 할 수 있습니다, zip 파일을 클릭하여 생성된 class 파일도 받을 수 있습니다.