So, I have been trying to make this code work for a couple of days and I don't know what I am doing wrong.

I am getting a JSON from the web and parsing it with Struct blocks.

The question is: I want to use the Dictionaries and Array from the JSON out of where I created de decode function.

Here is the code

```
import UIKit

struct  Currency_format: Decodable{
    var iso_code: String
    var example_format : String
    var decimal_digits : Int
    var decimal_separator : String
    var symbol_first : Bool
    var group_separator : String
    var currency_symbol : String
    var display_symbol : Bool
}

struct  Date_Format: Decodable{
    var format : String
}

struct Budgets: Decodable {
    var id : String
    var name: String
    var last_modified_on : String
    var first_month : String
    var last_month : String
    var date_format : Date_Format
    var currency_format : Currency_format
}

struct DataResponse : Decodable {
    var data : Data
}

struct Data : Decodable{
    var budgets : [Budgets]
}

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
    let accessToken = "1234"
    let authorizationRequestHeader = "https://www.somewhere.com=\(accessToken)"

    guard let url = URL(string: authorizationRequestHeader) else {
        print("Error")
        return
    }
    let session = URLSession.shared
    session.dataTask(with: url) { (stringData, response, Error) in
        let testString =  try! dataResponse.decode(DataResponse.self, from:stringData!)
        print("Number of records: \(testString.data.budgets.count)")
        //THIS PRINT WORKS AS I WANT IT TO WORK. NOT PROBLEM HERE
        }.resume()

  print("Number of records: \(testString.data.budgets.count)") // BUT THE SAME CODE HERE, DOES NOT WORK AT ALL

```