Skip to content

Commit

Permalink
Add getting a string using a path to the element.
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffGuKang committed Oct 28, 2016
1 parent 2f3d92e commit 5b7400f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Example/Playground.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -77,3 +77,22 @@ print(arrayOfString)
// Getting a string from a JSON Dictionary
jsonDictionary["country"].stringValue

//Getting a string using a path to the element
let path: [JSONSubscriptType] = ["users", 1, "info", "name"]
let feed = jsonArray[path].string

////Just the same
//let name = json[1]["list"][2]["name"].string
////Alternatively
//let name = json[1,"list",2,"name"].string
//
//
//```swift
////With a hard way
//let name = json[].string
//```
//```swift
////With a custom way
//let keys:[SubscriptType] = [1,"list",2,"name"]
//let name = json[keys].string
//```

0 comments on commit 5b7400f

Please sign in to comment.