I am building an app where people need to fill out a form and then it creates an HTTP post where the API will return a Json file to the app with data I need. Everything is working fine with accessing the API however I want to parse the data in another view controller. How can I access the JSON file from another view controller?
let task = session.dataTask(with: request as URLRequest, completionHandler: { data, response, error in
        guard error == nil else {
            return
        }
        guard let data = data else {
            return
        }
        do {
            //create json object from data
            if let json = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String: Any] {
                print(json)
 ^^^^^^^
 How do I take this JSON file to the next view controller so I dont have to do the parsing below?
                let jsonData = json
                let ratesJson = jsonData["rates"]!
                let rates = ratesJson as! NSArray
                print("Rates: \(rates)")
                print("*************")
                print(rates.count)
                print("*************")
                for item in 0..<rates.count {
                    let specificRate = rates[item]
                    let price = (specificRate as AnyObject)["amount_local"]!
                    let provider = (specificRate as AnyObject)["provider"]!
                    print("--\(item)--")
                    print("Price: \(price!)")
                    print("Provider: \(provider!)")
                }
            }
        } catch let error {
            print(error.localizedDescription)
        }
    })
 
     
    