Skip to content

Formatting output Objective-c dictionary properties.

License

Notifications You must be signed in to change notification settings

Jinxiansen/JPExport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JPExport 仅用于网络数据 responseObject 解析生成 property 。

Mac 版、Swift版待续…

支持 NSArray、NSDictionary、NSString、NSNumber、BOOL 。

Screenshots

示例如下:

原始数据


{
    errorcode = 2;
    data = 
    {
        age = 19;
        sex = "male";
        name = Jinxiansen;
        blog = "jinxiansen.com";
        course = 
        (
            {
                Chinese = 98;
                "Class_hour" = 53;
                population = "1.5 billion";
            },
            {
                color = red;
            },
            {
                English = 39;
                "class_6our" = 48;
                "class_size" = 40;
                "teacher_name" = jobs;
            }
        );
    };
}

原始数据转换


/** English */
@property (nonatomic, copy) NSString *English;
/** class_size */
@property (nonatomic, strong) NSNumber *class_size;
/** teacher_name */
@property (nonatomic, copy) NSString *teacher_name;
/** class_6our */
@property (nonatomic, copy) NSString *class_6our;

大小写转换


/** english */
@property (nonatomic, copy) NSString *english;
/** classSize */
@property (nonatomic, strong) NSNumber *classSize;
/** class6our */
@property (nonatomic, copy) NSString *class6our;
/** teacherName */
@property (nonatomic, copy) NSString *teacherName;


Requirements

  • 支持 iOS 8.0 +
  • 目前仅限 Objective-C

Manually

1. 需将 JPExport.h 和 .m 导入
2. 添加 #import "JPExport.h"

Usage

使用方式:

* 调用此方法 NSString * result = [JPExport exportFromDictionary:dict]; 会打印出 dict 中及嵌套的所有解析后的元素。
* 或打个断点😜,在请求网络成功时,使用 po [JPExport exportFromDictionary:dict]

推荐第2种方式,省事、方便。

Contacts

如果有甚么问题或者好建议,可以点 这里 提给我, 或 发邮件 or twitter .

License

JPExport is released under the MIT license. See LICENSE for details.

About

Formatting output Objective-c dictionary properties.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published