organics2016 / pojo2json

A simple plugin for converting POJO to JSON in IntelliJ IDEA
MIT License
72 stars 37 forks source link
intellij-plugin java json kotlin-language

English | 中文 | 日本語

POJO to JSON

A simple plugin for converting POJO to JSON in IntelliJ IDEA

Support JVM platform languages

Usage

Installation

Q&A

Support Annotations and Javadoc

Configure SpEL expression

What can SpEL expression do?

Configuration

Default Configuration

Random Value Configuration

Global JSON Keys Format Configuration

Expression Result Eg
Camel Case(Default) #{#field.getName()} or #{#field.getCamelCaseName()} testName
Snake Case #{#field.getSnakeCaseName()} test_name
Kebab Case #{#field.getKebabCaseName()} test-name
Pascal Case #{#field.getPascalCaseName()} TestName
Snake Case Upper #{#field.getSnakeCaseUpperName()} TEST_NAME

Configuration Details

Ref Expression Result Eg Support getRandomValue()
#boolean #{#boolean.getValue()} false
#array #{#array.getValue()} [] N
#object #{#object.getValue()} {} N
#decimal #{#decimal.getValue()} 0.00
#integer #{#integer.getValue()} 0
#localdatetime #{#localdatetime.getValue()} 2023-09-14 15:04:52
#localdate #{#localdate.getValue()} 2023-09-14
#localtime #{#localtime.getValue()} 15:04:52
#yearmonth #{#yearmonth.getValue()} 2023-09
#temporal #{#temporal.getValue()} 1694675092600
#zoneddatetime #{#zoneddatetime.getValue()} 2023-09-14T15:04:52.601+08:00
#uuid #{#uuid.getValue()} 679e70fa-d24b-4726-ab87-2de620333f20 N
#shortuuid #{#shortuuid.getValue()} 732f65b6b9cf N
#datetime #{#datetime.getValue()} 2023-09-14T15:04:52.601+08:00

Contributors

Ideas and partial realization from linsage