Question: I have a JSON file that was filtered and lost the original structure. Each line of the file looks like this:

```
{u'spec1': {u'property1': u'12345', u'property2': 1234}, u'spec2': {u'property3': u'98754', u'property4': u'val1'}}

```

`json.loads` doesn't work and `ast.literal_eval` doesn't work. I guess I have 2 issues: remove unicode and change ' to ". Can anyone provide some pointers on where to start?

Answer: 
You can unwrap it this way:

```
if let yourStr = str_VAR?.toInt() {
    println("str_VAR = \(yourStr)")  //"str_VAR = 100" 
    println(yourStr)                 //"100"

}

```

Refer [THIS](https://stackoverflow.com/questions/24034483/what-is-an-unwrapped-value-in-swift) for more info.

**When to use “if let”?**

`if let` is a special structure in Swift that allows you to check if an Optional holds a value, and in case it does – do something with the unwrapped value. Let’s have a look:

```
if let yourStr = str_VAR?.toInt() {
    println("str_VAR = \(yourStr)")
    println(yourStr)

}else {
    //show an alert for something else
}

```

The if let structure unwraps `str_VAR?.toInt()` (i.e. checks if there’s a value stored and takes that value) and stores its value in the `yourStr` constant. You can use `yourStr` inside the first branch of the if. Notice that inside the if you don’t need to use ? or ! anymore. It’s important to realise that`yourStr` is actually of type `Int` that’s not an Optional type so you can use its value directly.
Try this:

```
if let i = str_VAR?.toInt() {
    println("\(i)")
}

```