JSON → Java ClassesLocal processing · 0 network requests
Paste JSON to generate Java POJOs. Nested objects become separate classes, and Lombok can reduce getter/setter boilerplate.
How do I convert JSON to Java POJOs?
Paste an API response JSON to generate Java POJOs. Choose Jackson or Fastjson field mapping annotations, date types, and Lombok @Data. Date detection uses string patterns only; verify generated types against your API contract.
How are numbers mapped?
Integers map to Long and decimals to Double. If your values fit within the int range, you can change the type to Integer.
What about nested objects and arrays?
Nested objects become separate classes named from their field. Arrays map to List<T> based on sample elements; mixed-type or empty arrays use List<Object>.
Are field names converted to camelCase?
Yes. Names such as user_name are converted to camelCase, for example userName, to follow Java naming conventions.
When to use JSON to Java conversion
When API documentation provides only a JSON example, use this tool to draft Java fields and nested types. Then add serialization annotations, validation rules, and business methods for your framework. Conversion runs locally in your browser.
What should I review after generation?
- Integers default to
Longand decimals toDouble. Adjust them to match the API value range. - Array element types are inferred from samples; empty or mixed arrays fall back to
List<Object>. - Fields such as
user_namebecomeuserName. Check field mapping when integrating Jackson or another framework. - Lombok generates
@Dataonly. Your project must include the matching Lombok, Jackson/Fastjson, or date-type dependencies. Date types are inferred from sample string patterns.
For Java types and naming, see Java Language Specification; for JSON interchange, see RFC 8259.
Java POJO example
{"id":1,"name":"示例"}The result contains Long id and String name. Without Lombok, only fields are generated; add accessors as needed and check serialization mapping after renaming fields.
Updated: · Local processing & limitations
Example with nested objects, empty arrays, and null
{"id":1,"profile":{"name":"demo"},"tags":["a"],"empty":[],"value":null}Without Lombok, the output includes Root and Profile: id is Long, profile is Profile, tags is List<String>, empty is List<Object>, and value is Object. One sample cannot capture every business type; review nulls and empty arrays against your API documentation.