欢迎光临
我们一直在努力

Json字符串转模型类在线工具

建站超值云服务器,限时71元/月

Json字符串转模型类在线工具

项目介绍:

JsonToModelOnLine

github地址:https://github.com/SmileZXLee/JsonToModelOnLine

在线地址(点击直接访问):http://www.zxlee.cn/JsonToModelOnLine/index.html

主要功能

  • 支持语言:Java、PHP、Objective-C、Swift、C#、JavaScript

  • 支持下划线转驼峰或驼峰转下划线

  • 支持添加注释头

  • 支持任意层级的Json数据,自动过滤重复数据

图片描述

使用示例

示例Json数据(来源于聚合数据API文档)

{
    "error_code": 0,
    "success": true,
    "reason": "success",
    "result": {
        "collectCount": "4170000",
        "crawlTime": "2019-01-24 16:43:58",
        "ranks": [
            {
                "rankStr": "1-1",
                "title": "聚合工具 - 聚合数据",
                "url": "http:\/\/tool.chinaz.com\/",
                "xiongzhangId": "聚合数据"
            },
            {
                "rankStr": "1-2",
                "title": "聚合素材-分享综合设计素材的平台",
                "url": "http:\/\/sc.chinaz.com\/",
                "xiongzhangId": ""
            }
        ]
    }
}

转Java模型类

----- 共3条Model数据 -----
private String collectCount;
private String crawlTime;
private Object[] ranks;
----------------------------
private String rankStr;
private String title;
private String url;
private String xiongzhangId;
----------------------------
private int error_code;
private boolean success;
private String reason;
private Object result;
----------------------------
  • 驼峰转下划线

----- 共3条Model数据 -----
private String collect_count;
private String crawl_time;
private Object[] ranks;
----------------------------
private String rank_str;
private String title;
private String url;
private String xiongzhang_id;
----------------------------
private int error_code;
private boolean success;
private String reason;
private Object result;
----------------------------

转PHP模型类

----- 共3条Model数据 -----
public $collectCount;
public $crawlTime;
public $ranks;
----------------------------
public $rankStr;
public $title;
public $url;
public $xiongzhangId;
----------------------------
public $error_code;
public $success;
public $reason;
public $result;
----------------------------

转Objective-C模型类

----- 共3条Model数据 -----
@property (copy, nonatomic) NSString *collectCount;
@property (copy, nonatomic) NSString *crawlTime;
@property (strong, nonatomic) NSArray *ranks;
----------------------------
@property (copy, nonatomic) NSString *rankStr;
@property (copy, nonatomic) NSString *title;
@property (copy, nonatomic) NSString *url;
@property (copy, nonatomic) NSString *xiongzhangId;
----------------------------
@property (assign, nonatomic) int error_code;
@property (assign, nonatomic) BOOL success;
@property (copy, nonatomic) NSString *reason;
@property (strong, nonatomic) id result;
----------------------------

转Swift模型类

----- 共3条Model数据 -----
var collectCount :String?
var crawlTime :String?
var ranks :Array?
----------------------------
var rankStr :String?
var title :String?
var url :String?
var xiongzhangId :String?
----------------------------
var error_code :Int?
var success :Bool?
var reason :String?
var result :any?
----------------------------

转C#模型类

----- 共3条Model数据 -----
public string collectCount { get; set;};
public string crawlTime { get; set;};
public List <Object> ranks { get; set;};
----------------------------
public string rankStr { get; set;};
public string title { get; set;};
public string url { get; set;};
public string xiongzhangId { get; set;};
----------------------------
public int error_code { get; set;};
public boolean success { get; set;};
public string reason { get; set;};
public Object result { get; set;};
----------------------------

转JavaScript模型类

----- 共3条Model数据 -----
var collectCount;
var crawlTime;
var ranks;
----------------------------
var rankStr;
var title;
var url;
var xiongzhangId;
----------------------------
var error_code;
var success;
var reason;
var result;
----------------------------

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Json字符串转模型类在线工具
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址