Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnlui/jsonneverdie
Auto reflection tool from JSON to Model, user friendly JSON encoder / decoder, aims to never die
https://github.com/johnlui/jsonneverdie
auto-reflection ios json swift
Last synced: 7 days ago
JSON representation
Auto reflection tool from JSON to Model, user friendly JSON encoder / decoder, aims to never die
- Host: GitHub
- URL: https://github.com/johnlui/jsonneverdie
- Owner: johnlui
- License: mit
- Created: 2015-09-27T11:46:04.000Z (about 9 years ago)
- Default Branch: swift4
- Last Pushed: 2018-04-10T03:46:37.000Z (over 6 years ago)
- Last Synced: 2024-12-08T19:21:54.299Z (15 days ago)
- Topics: auto-reflection, ios, json, swift
- Language: Swift
- Homepage:
- Size: 949 KB
- Stars: 450
- Watchers: 20
- Forks: 39
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
JSONNeverDie is an auto reflection tool from JSON to Model, a user friendly JSON encoder / decoder, aims to never die. Also JSONNeverDie is a very important part of [Pitaya](https://github.com/johnlui/Pitaya).
### [中文介绍](#中文介绍)
## Example
set up a Model:```swift
class People: JSONNDModel {
@objc var name = ""
}
```
reflex JSON to Model automatic:```swift
let json = JSONND(string: "{\"name\": \"JohnLui\"}")
let people = People(JSONNDObject: json)
print(people.name)
```## Features
### reflection features
- [x] JSON to Model reflection automatic
- [x] auto reflection with no need of init()
- [x] supports multi-level reflection#### [Read the documentation of auto reflection](https://github.com/johnlui/JSONNeverDie/wiki).
### JSON encode / decode features
- [x] supports all types: Int, Double, Bool, String, Array
- [x] user friendly: Xcode can prompt all available types
- [x] provides both Optional-type(Int?) and Original-type(Int)And JSONNeverDie is well tested.
## Requirements
* iOS 7.0+
* Swift 4 (Version 3) in current swift4 branch
* Swift 3 (Version 2) in swift3 branch
* Swift 2.x / Xcode 7 (Version 1.x) in master branch##Contribution
You are welcome to fork and submit pull requests.
##License
JSONNeverDie is open-sourced software licensed under the MIT license.
# 中文介绍
## 基本示例
构建一个 Model:```swift
class People: JSONNDModel {
@objc var name = ""
}
```
从字符串转换成 JSON 再自动映射为 Model:```swift
let json = JSONND(string: "{\"name\": \"JohnLui\"}")
let people = People(JSONNDObject: json)
print(people.name)
```### [中文文档](https://github.com/johnlui/JSONNeverDie/wiki/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3)
## 参与开源
欢迎提交 issue 和 PR,大门永远向所有人敞开。
## 开源协议
本项目遵循 MIT 协议开源,具体请查看根目录下的 LICENSE 文件。