Skip to content

Commit 52486aa

Browse files
committed
Update README.md
1 parent 114f556 commit 52486aa

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,20 @@ let json = JSON(data: dataFromNetworking)
112112
```swift
113113
let json = JSON(object: jsonObject)
114114
```
115+
####Loop
116+
```swift
117+
let json = JSON(data:dataFromNetworking)
118+
//If json is .Mapping
119+
for (key: String, subJson: JSON) in json {
120+
//Do something you want
121+
}
122+
123+
//If json is .Sequence
124+
//The `index` is 0..<json.count's string value
125+
for (index: String, subJson: JSON) in json {
126+
//Do something you want
127+
}
128+
```
115129

116130
####Use the optional getter
117131
```swift
@@ -170,7 +184,7 @@ let list: Array<JSON> = json["list"].arrayValue
170184
let user: Dictionary<String, JSON> = json["user"].dictionaryValue
171185
```
172186

173-
###Get the raw object from JSON
187+
####Get the raw object from JSON
174188
```swift
175189
let json = JSON(data: dataFromNetworking)
176190
if let jsonObject: AnyObject = json.object {

0 commit comments

Comments
 (0)