swifty-json

SwiftyJSON Performance Issues

强颜欢笑 提交于 2019-12-03 05:57:16
问题 I'm having serious performance issues parsing JSON with SwiftyJson from our API and populating in core data. The data is downloaded with Alamofire, wich works nicely but parsing the json with SwiftyJson is painfully slow. To see if the library really was the problem i rewrote the json parsing in one of the many places the data is parsed. In the code below I am parsing the opening hours of one of about 400 tourist attractions. See the difference in these screenshots, 7,7 sec to 185 ms: The

How can you subset a SwiftyJSON JSON object

眉间皱痕 提交于 2019-12-02 18:22:22
问题 I am building an iOS app in which one of my API calls returns a large JSON blob that I load into a JSON object using SwiftyJSON. For example, it looks something like this { "data": { "name":"object name", "id":1, "description":"short description of object", "type":"type", "runs":[ ], } As part of the app the user can modify things like the name, but the API endpoint for the PATCH call needs to have the runs key removed. Does anyone know how to take a SwiftyJSON JSON object and create a new

How can you subset a SwiftyJSON JSON object

♀尐吖头ヾ 提交于 2019-12-02 11:21:25
I am building an iOS app in which one of my API calls returns a large JSON blob that I load into a JSON object using SwiftyJSON. For example, it looks something like this { "data": { "name":"object name", "id":1, "description":"short description of object", "type":"type", "runs":[ ], } As part of the app the user can modify things like the name, but the API endpoint for the PATCH call needs to have the runs key removed. Does anyone know how to take a SwiftyJSON JSON object and create a new one that has a subset of keys. For example, I want the JSON blob to look like { "data": { "name":"object

how to parsing Json with SwiftyJson from woocommerce api?

谁说我不能喝 提交于 2019-12-02 08:32:45
I want to parse JSON using alamofire and swiftyjson I try get JSON(value) like this let headers: HTTPHeaders = [ "Authorization": "Basic Y2tfZTA1ZGNmMDkwNTNmODEyMGQwYTMyOGI4YzJkY2QzOTY5MmE5ZDAyNzpjc18zYzZiYWY2NTM0NDhkNDM4ZDM1ZDNmNDY5Nzg5ZGM2Y2VhZGRiZjNl", "Accept": "application/json" ] Alamofire.request("https://woo.demoapp.xyz/wp-json/wc/v2/products?category=15", headers: headers).responseJSON { response in debugPrint(response) if let json = response.result.value { print("JSON: \(json)") } } here is the JSON data from woocommerce api [ { "id": 29, "name": "Sunglasses", "permalink": "https:/

Display Nested array from JSON data to tableview using Alamofire

南笙酒味 提交于 2019-12-02 08:05:54
问题 I have displayed first json data in tableview but when trying to display array data of inner array data it's showing blank data on table view , I have tired many ways sometimes it showing me Index out of range don't know where i'am getting wrong or forget to write code , I'am able to display that Fees class data in table view but not able to display description data ,Or do i need to change my Ui desgin here i have model class class Fees { var Billno = String() var DateOfReciept = String() var

Postman request to Alamofire request

允我心安 提交于 2019-12-02 07:48:59
I'm having no issues when I make the post request with POSTMAN but when I use alamofire I have issues. The post still goes through on the alamofire request but the data is not received the same way. What does an alamofire request look like that's the exact same as the following postman... Swift 2.x : typealias apiSuccess = (result: NSDictionary?) -> Void typealias apiProgress = (result: NSDictionary?) -> Void // when you want to download or upload using Alamofire.. typealias apiFailure = (error: NSDictionary?) -> Void // Normal http request with JSON response.. func callJSONrequest(url:String,

How Can I Parse Json In Json With SwiftyJSON?

只谈情不闲聊 提交于 2019-12-02 03:22:59
I am returning the following JSON from an API. In my database, I store a list in JSON already. Thus, it gives us a string of JSON inside JSON. How can I access these as objects in Swift? More to the point: How can I parse JSON inside of JSON? { "checklists": [ { "id": 1, "account_id": 15, "user_id": 15, "object_id": 21, "checklist": "[{\"title\":\"Test\",\"summary\":\"Test 12\"},{\"title\":\"Test 2 \",\"summary\":\"Test 123\"}]", "title": "High Altitude Operations", "type": "other", "LastHistory": null, "CleanArray": [ { "title": "Test", "summary": "Test 12" }, { "title": "Test 2 ", "summary":

How to use SwiftyJSON on nested JSON values

一笑奈何 提交于 2019-12-01 18:19:45
I'm calling a JSON API that has several nested values that I need to get. I'm using SwiftyJSON to make things a little cleaner. For the top level values, everything seems to be working fine, but on anything deeper, I'm getting the dreaded "nil when unwrapping optional value." Here is how I'm making the API call with Alamofire: Alamofire.request(APIRequests.Router.Nearby(self.page)).responseJSON(){ (_,_,json,_) in println(json) if (json != nil){ var jsonObj = JSON(json!) if let userArray = jsonObj ["results"].array { for userDict in userArray { var username: String! = userDict["username"]

How to use SwiftyJSON on nested JSON values

…衆ロ難τιáo~ 提交于 2019-12-01 18:19:40
问题 I'm calling a JSON API that has several nested values that I need to get. I'm using SwiftyJSON to make things a little cleaner. For the top level values, everything seems to be working fine, but on anything deeper, I'm getting the dreaded "nil when unwrapping optional value." Here is how I'm making the API call with Alamofire: Alamofire.request(APIRequests.Router.Nearby(self.page)).responseJSON(){ (_,_,json,_) in println(json) if (json != nil){ var jsonObj = JSON(json!) if let userArray =

How to parse the json data using swiftJson along with Alamofire

余生颓废 提交于 2019-12-01 10:52:42
my Json data sample. this is only a sample of data .Likewise so much data available like number of subcategory is 22. number of items are different according to subcategory.Also number of rows are 15 in which the first name is Pizza. [ { "id": "244", "name": "PIZZAS", "image": "", "coupon": "1", "icon": "", "order": "1", "aname": "", "options": "2", "subcategory": [ { "id": "515", "name": "MARGARITA", "description": "Cheese and Tomato", "image": "", "icon": "", "coupon": "1", "order": "1", "aname": "", "options": "2", "item": [ { "id": "1749", "name": "9 Inch Thin & Crispy Margarita",