Create POJO Class for Kotlin
I think this should be the Plugin what you want
https://github.com/wuseal/JsonToKotlinClass
Yes, I got solution
for Example:
{
"foo": "string",
"bar": "integer",
"baz": "boolean"
}
My POJO Class Created using http://www.jsonschema2pojo.org/
Example.java
public class Example {
@SerializedName("foo")
@Expose
private String foo;
@SerializedName("bar")
@Expose
private String bar;
@SerializedName("baz")
@Expose
private String baz;
public String getFoo() {
return foo;
}
public void setFoo(String foo) {
this.foo = foo;
}
public String getBar() {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
public String getBaz() {
return baz;
}
public void setBaz(String baz) {
this.baz = baz;
}
}
Converted Kotlin Class using Code -> Convert Java File to Kotlin File
or CTRL + ALT + SHIFT + K
Example.kt
class Example {
@SerializedName("foo")
@Expose
var foo: String? = null
@SerializedName("bar")
@Expose
var bar: String? = null
@SerializedName("baz")
@Expose
var baz: String? = null
}
Thank you all.