• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

jonfhancock/JsonToJava: I was fed up with writing Java classes to mirror json mo ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

jonfhancock/JsonToJava

开源软件地址:

https://github.com/jonfhancock/JsonToJava

开源编程语言:

Java 57.0%

开源软件介绍:

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:

Give it:
  • a url to a json file
  • a package name for the classes it will generate
  • the name of the base class to start with.
  • optionally, the p option will make your classes parcelable.
  • optionally, the g option will give your classes gson annotations for serialization.
  • optionally, the s option will override the toString method.

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 a zip file.

The easiest way to actuall use this is to go to http://jsontojava.appspot.com/
There you can just put in the variables and click download.

When run from the commandline, it looks like this:

java -jar JsonToJava.jar -url http://example.com/folder.json -package com.example.api.model -class Folder -p -g

Each class will implement Parcelable for easy passing of information in Android (optional). 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. (optional) 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

  • 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



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap