installation
Method One:
1.Android Studio File->settings. ->plugins–>browse Repositores. Search Gsonformat
2. Install the plugin and restart Android Studio
Method Two:
1. Download Gsonformat.jar;
2.Android Studio File->settings. ->plugins–>install plugin from disk. Import Download Gsonformat.jar
3. Restart Android Studio
How to use
Use the Generate shortcut key in the entity class.
Shortcut keys: The selected part of the diagram
Simple entity classes
Simple JSON format in the diagram
{
"Name": "Harry",
"Gender": "Man",
"Age": 15,
"Height": "140cm",
}
Build Result:
Package zhangxueyuan.myapplication;/** * created by xueyuan on 2015/6/15. */public class bean { /** * height : 140cm * age : 15 * name : Harry * gender : man */ private string height; private int age; private string name; private string gender; public void setheight (string height) { this.height = height; } public void setage (int age) { this.age = age; } public void setname (String name) { this.name = name; } public void setgender (String gender) { this.gender = gender; } public String GetHeight () { return height; } public int getage () { Return age; } public string getname () { return name; } public string getgender () { return gender; }}
Found no need to inherit jsonmodle.
Complex situation will not write, you can see the original address, the personal feel because some reuse, generally will not be written like that.
Androidstudio plug-in Gsonformat fast implementation JavaBean