Skip to content

Commit d03f3c6

Browse files
committed
Update README.md
1 parent b321bec commit d03f3c6

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

README.md

+47-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,49 @@
11
# JSON
22

3-
A description of this package.
3+
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:
35+
36+
```swift
37+
let package = Package(
38+
dependencies: [
39+
.package(
40+
url: "https://github.com/shareup/json-apple.git",
41+
from: "1.0.0"
42+
)
43+
]
44+
)
45+
```
46+
47+
## License
48+
49+
The license for JSON is the standard MIT licence. You can find it in the `LICENSE` file.

0 commit comments

Comments
 (0)