Java Class From JSON Generator

Sep 18, 2018

Generate annotated POJO or stub classes from JSON document.



Input: Paste JSON content below

Settings

Output: Generated Classes


Generate Newtonsoft annotated C# model or stub classes from JSON text, document, file or data

View Tool

Generate Java Class from JSON

Use this tool to quickly generate model classes for Java or POJOs from a sample JSON document. The Java model classes are annotated using JsonProperty attribute supplied by Jackson.

JSON

JavaScript Object Notation (JSON), pronounced as Jason, is the most common data interchange format on the web. Douglas Crockford first released the JSON specification in the early 2000s. It is a simple format that is easier to comprehend than XML. It is also smaller in size because it does not have closing tags. A wide variety of programming languages can parse JSON files. They also support the serialization of data structures to JSON. You can copy JSON text to JavaScript and start using them without any modifications.

Settings Explained
  • 1. Annotate

    If selected, properties are annotated using Newtonsoft.Json's JsonProperty attribute.

    Annotate On

    public class Person {
        private String name;
        private int age;
    
        @JsonProperty("name")
        public String getName() {
            return name;
        }
    
        @JsonProperty("name")
        public void setName(String name) {
            this.name = name;
        }
    
        @JsonProperty("age")
        public int getAge() {
            return age;
        }
    
        @JsonProperty("age")
        public void setAge(int age) {
            this.age = age;
        }
    }
    Annotate Off

    public class Person {
        private String name;
        private int age;
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    
        public int getAge() {
            return age;
        }
    
        public void setAge(int age) {
            this.age = age;
        }
    }
Comments 0

History
Sep 18, 2018
Tool Launched