File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,20 @@ let json = JSON(data: dataFromNetworking)
112
112
``` swift
113
113
let json = JSON (object : jsonObject)
114
114
```
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
+ ```
115
129
116
130
####Use the optional getter
117
131
``` swift
@@ -170,7 +184,7 @@ let list: Array<JSON> = json["list"].arrayValue
170
184
let user: Dictionary <String , JSON> = json[" user" ].dictionaryValue
171
185
```
172
186
173
- ###Get the raw object from JSON
187
+ #### Get the raw object from JSON
174
188
``` swift
175
189
let json = JSON (data : dataFromNetworking)
176
190
if let jsonObject: AnyObject = json.object {
You can’t perform that action at this time.
0 commit comments