https://github.com/beyova/beyovajson
BeyovaJSON allows any json for Coadable
https://github.com/beyova/beyovajson
codable json swift
Last synced: about 1 year ago
JSON representation
BeyovaJSON allows any json for Coadable
- Host: GitHub
- URL: https://github.com/beyova/beyovajson
- Owner: Beyova
- License: mit
- Created: 2017-10-28T11:33:45.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2025-04-10T09:34:32.000Z (about 1 year ago)
- Last Synced: 2025-04-10T10:49:50.635Z (about 1 year ago)
- Topics: codable, json, swift
- Language: Swift
- Homepage:
- Size: 30.3 KB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BeyovaJSON
[](https://travis-ci.org/Beyova/BeyovaJSON)
[](https://github.com/Carthage/Carthage)


BeyovaJSON allows any json for Coadable in Swift 4.
## Installation
#### CocoaPods
```ruby
pod 'BeyovaJSON'
```
#### Carthage
```
github "Beyova/BeyovaJSON"
```
## Usage
```swift
import BeyovaJSON
```
#### Codable
`Codable` is added with Xcode 9, iOS 11 and Swift 4.
It is used to make your data types encodable and decodable for compatibility with external representations such as JSON.
```swift
class Group: Codable {
var title: String = "Guardians of the Galaxy"
var members: JSON = [["name": "Star-Lord"],["name": "Groot"],["name": "Rocket"]]
var date: Date = Date()
}
let group = Group()
let encoder = JSONEncoder()
encoder.outputFormatting = .prettyPrinted
let data = try! encoder.encode(group)
print(String(bytes: data, encoding: .utf8)!)
```