GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - jonfhancock/JsonToJava at dff7b3764be6cfa9da1999b09888ea3d69f896b4

BranchesTags
Open more actions menu

Latest commit

 

History

22 Commits
22 Commits

Folders and files

NameName
Last commit message
Last commit date
.settings
.settings
 
 
libs
libs
 
 
src
src
 
 
.classpath
.classpath
 
 
.gitignore
.gitignore
 
 
.project
.project
 
 
JsonToJava.jar
JsonToJava.jar
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.xml
build.xml
 
 

Repository files navigation

Json2Java

I was fed up with writing Java classes to mirror json models. So I wrote this Java app to automate the process.

What this tool can do right now:

when run from the commandline, it takes three arguments:

  • a url to a json file
  • a package name for the classes it will generate
  • the name of the base class to start with.
e.g. java -jar JsonToJava http://example.com/folder.json com.example.api.model Folder

It will create the folder structure for the package you provide, then it will read the json at the url you provide, and output java classes into the folder locally.

Each class will implement Parcelable for easy passing of information in Android. Each class will have a default empty constructor. The members of each class will follow Android naming conventions with an "m" prefix and camel case. Each member will have a corresponding static final String that relates it to it's json counterpart Each member will have a @SerializedName annotation for very easy Gson parsing. If a member called "mId" or "mUniqueId" is found, then equals and hashcode will be overridden so comparisons are made on the id.

What I want this tool to do in the future in no particular order

  • Work as an App Engine app
  • Accept either a url or a block of json pasted in a text box
  • Extract superclasses
  • Accept multiple urls to build up the whole model
  • Allow the user to choose between Gson annotations, Jackson annotations, org.json constructors and toJson() methods, or none of the above
  • Give users the ability to rename classes
  • Give users the ability to ignore classes

About

I was fed up with writing Java classes to mirror json models. So I wrote this Java app to automate the process.

Resources

Readme
License
Activity

Stars

303 stars

Watchers

23 watching

Forks

76 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.