clowwindy / json_to_model

iOS ORM via Code Generation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON to model

Build Status PyPI version

Convert JSON api to Objective-C and Swift model source files.

Got tired of writing models and JSON parsers? Then generate them automatically!

Please consider contributing code. Please send me bug reports and issues.

usage

Suppose you have a json file input/comment.json:

{
    "__class__": "User",
    "username": "Alice",
    "age": 17,
    "email": "alice@somemail.com",
    "registered": true
}

Run:

pip install json_to_model
json_to_model -i input/ -o output/ -l objc

You'll get:

~/models/User.h
~/models/User.m

All properties and init methods and helper methods for JSON convertion are also generated. null is handled. Other classes on the properties, arrays will also be converted recursively.

See examples for how it works.

About

iOS ORM via Code Generation

License:Other


Languages

Language:Python 34.4%Language:Objective-C 33.7%Language:Swift 31.6%Language:Shell 0.3%