skip to Main Content

JSONDecoder returning nil while parsing

I have the following function: func executeGet( completion: @escaping (Data?, Error?) -> Void) { AF.request("https:URL", method:.get, headers:headers).response{ response in debugPrint(response) if let error = response.error { completion(nil, error) } else if let jsonArray = response.value as? Data{ completion(jsonArray, nil) }…

VIEW QUESTION

Not able to parse JSON data from text file using python script

I have a '.txt' file that contains JSON data like below. [{'tradable': True, 'mode': 'full', 'instrument_token': 4708097, 'last_price': 178.65, 'last_traded_quantity': 5, 'average_traded_price': 180.1, 'volume_traded': 4581928, 'total_buy_quantity': 1282853, 'total_sell_quantity': 1673842, 'ohlc': {'open': 181.95, 'high': 181.95, 'low': 177.8, 'close': 181.0}, 'change': -1.2983425414364609,…

VIEW QUESTION
Back To Top
Search