You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JSON is a simple, type-safe JSON type implemented in pure Swift. It's intended to be lightweight and ergonomic. Most especially, it can be used in model value types that need to be sendable.
4
+
5
+
## Usage
6
+
7
+
```swift
8
+
let json: JSON = [
9
+
"one":2,
10
+
"two_text":"two",
11
+
"pi":3.14,
12
+
"yes":true,
13
+
"null":nil,
14
+
"object": [
15
+
"three":3,
16
+
"four_text":"four",
17
+
"null":nil,
18
+
"inner_array": [
19
+
"index_0",
20
+
false,
21
+
4.20,
22
+
] as [Any?],
23
+
] as [String: Any?],
24
+
]
25
+
26
+
json["one"].integerValue// 2
27
+
json["object"]["four_text"].stringValue// "four"
28
+
```
29
+
30
+
## Installation
31
+
32
+
### Swift Package Manager
33
+
34
+
To use JSON with the Swift Package Manager, add a dependency to your `Package.swift` file:
0 commit comments