Skip to content

inekipelov/swift-json-value

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSONValue

JSONValue is a Swift Package for encoding, decoding, and constructing arbitrary JSON values without a fixed Codable model.

Swift 6.0+ iOS 13.0+ macOS 10.15+ tvOS 13.0+ watchOS 6.0+ visionOS 1.0+

Usage

import Foundation
import JSONValue

let value: JSONValue = [
    "id": 42,
    "name": "Ada",
    "active": true,
    "rating": 4.5,
    "tags": ["swift", nil]
]

let name = value["name"]
let firstTag = value["tags"]?[0]
let active = value.active

let data = try JSONEncoder().encode(value)
let decoded = try JSONDecoder().decode(JSONValue.self, from: data)

Installation

.package(url: "https://github.com/inekipelov/swift-json-value.git", from: "1.0.0")

About

`JSONValue` struct for JSON parsing

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages