Skip to main content

Generate Mantle models using JSON files

Project description

JSON2Mantle
========================

Generate [Mantle](https://github.com/Mantle/Mantle) models using JSON files.

##Quick start

### Install

```
pip3 install JSON2Mantle
```

### Usage

```
json2mantle [-h] [--prefix PREFIX] [--author AUTHOR]
json_file output_dir

```

### Example

```
json2mantle api_model.json class --prefix XYZ --author "John Smith"
```

will generate Mantle models according to your `api_model.json` structure. The output files will be created under `output_dir` directory, the author name will be `John Smith`, and the Objective-C classes have the prefix `XYZ`.

## Features

* Supports nested JSON data, which means JSON2Mantle can generate the correct number of classes that the JSON file contains.
* Convert field name like `var_name` to `varName` automatically.
* Python 3.

## Note

* When reserved words in Objective-C appear, it will replace the original name with a prefix `model`. For instance, if you have a field with the name `id`, the generated one would be `modelId`.
* Only supports generating Objective-C files.
* If the input JSON file is an array, it will ask you to give a name for the array items.

## TODO
- [ ] reserved words
- [ ] URL type
- [ ] Python 2 compatible

## License
The MIT License (MIT)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

JSON2Mantle-0.0.3.tar.gz (6.0 kB view details)

Uploaded Source

File details

Details for the file JSON2Mantle-0.0.3.tar.gz.

File metadata

  • Download URL: JSON2Mantle-0.0.3.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for JSON2Mantle-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a24a6462dcd3cf62db153454638195a635456cadb7f4ed6698f6cfad8463c5f1
MD5 3f9d8a37753c26c2f9baffcbe636a1a3
BLAKE2b-256 83d22220a7554ed2957f55c17b0d3c40a30cd6a8f334455d58657cc1a16ae537

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page