Skip to content

The fastest, most convenient and most nonintrusive conversion between JSON and model.Your model class don't need to extends another base class. Nonintrusive, convenient.

License

Notifications You must be signed in to change notification settings

CoderWan/MJExtension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MJExtension

Conversion between JSON and model

一、MJ友情提醒

  • MJExtension是一套“字典和模型之间互相转换”的轻量级框架
  • MJExtension能完成的功能
  • 字典(JSON) --> 模型(model)
  • 模型(model) --> 字典(JSON)
  • 字典数组(JSON array) --> 模型数组(model array)
  • 模型数组(model array) --> 字典数组(JSON array)
  • 具体用法主要参考 main.m中各个函数 以及 "NSObject+MJKeyValue.h"
  • 希望各位大神能用得爽

二、部分API用法

  • 将字典的键值对转成模型属性

    • (void)setKeyValues:(NSDictionary *)keyValues;
  • 将模型转成字典

    • (NSDictionary *)keyValues;
  • 通过模型数组来创建一个字典数组

    • (NSArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray;
  • 通过字典来创建一个模型

    • (instancetype)objectWithKeyValues:(NSDictionary *)keyValues;
  • 通过plist来创建一个模型(仅限于mainBundle中的文件)

    • (instancetype)objectWithFilename:(NSString *)filename;
  • 通过plist来创建一个模型

    • (instancetype)objectWithFile:(NSString *)file;
  • 通过字典数组来创建一个模型数组

    • (NSArray *)objectArrayWithKeyValuesArray:(NSArray *)keyValuesArray;
  • 通过plist来创建一个模型数组

    • (NSArray *)objectArrayWithFilename:(NSString *)filename;
  • 通过plist来创建一个模型数组

    • (NSArray *)objectArrayWithFile:(NSString *)file;

About

The fastest, most convenient and most nonintrusive conversion between JSON and model.Your model class don't need to extends another base class. Nonintrusive, convenient.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 94.1%
  • Roff 5.0%
  • Ruby 0.9%