swifty-json

Filter Data in SwiftyJson

做~自己de王妃 提交于 2019-12-11 16:16:49
问题 I have one SwiftyJson object. I can not filter that array. I have tried this solution https://stackoverflow.com/a/37497170/4831567. But my json format is different that's why not working. [ { "name": "19860", "header": { "start_time": "1519270200", "end_time": "1519299000", "state": "lunch" }, "alerts": "1", "venue": { "location": "Delhi, India", "timezone": "+05:30" }, "srs_category": [ 0, 1 ] }, { "name": "19861", "header": { "start_time": "1519270200", "end_time": "1519299000", "state":

Parse JSON with similar elements using SwiftyJSON

烂漫一生 提交于 2019-12-11 15:40:54
问题 I have this type of JSON (just a short sample): "orderProducts": [ { "id": 135, "order_id": 39, "product_id": 49, "product_code": "", "size_id": 13, "quantity": 2, "product": { "id": 49, "code": "", "factory_id": 2, "product_category_id": 1, "sex_id": null, "season_id": null, "product_type_id": null, "type_id": null, "color_id": null, "year_id": null, "image_1": "bceef8b28ae2a1797ca0c6300021100d.jpeg", "image_2": "", "image_3": "", "notes": "", "status": 10 } }, { "id": 136, "order_id": 39,

Getting non-master branch from Cocoapods?

早过忘川 提交于 2019-12-11 12:41:25
问题 I've been using SwiftyJSON and Alamofire in a project. Recently I downloaded XCode 7 beta. Both SwiftyJSON and Alamofire have separate, non-master branches for Swift 2. Is there a way to get these via CocoaPods, or do I need to install them in the traditional way? I tried searching on the CocoaPods website to see if these branches had been submitted as separate Pods, but nothing came up. I'm wondering if there is a Podfile syntax that allows you to get a non-master branch. 回答1: You can

How to use swiftyjson to parse json data to foundation object and loop through data

我与影子孤独终老i 提交于 2019-12-11 12:29:28
问题 So I'm trying to get his raw json data and use it to ultimately be viewed in a table(so one table cell would be --> Emirates - $1588.77) Problem: Having trouble parsing the JSON data.. alamofire apparently does it automatically? but im completely confused with the data types. I keep getting weird errors like 'doesnt have a member named subscript" (I've also got swiftyjson installed but aa non-swiftyjson solution should work as well. Code: request(qpxRequest).responseJSON { (request, response,

Unable to convert data to string around character

南楼画角 提交于 2019-12-11 06:09:09
问题 i'm trying to do an HTTP-Get request to get users on my database. After the data return from the request i use SwiftyJson library to get the users. But, one of the users in his name contains the character "ò" and i received this error: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Unable to convert data to string around character 208." UserInfo={NSDebugDescription=Unable to convert data to string around character 208.}) Here is my code: func makeHTTPGetRequest(path: String, onCompletion

How to parse this PayPal JSON response with AnyHashable value using SwiftyJSON?

时光毁灭记忆、已成空白 提交于 2019-12-11 04:45:35
问题 I'm using PaypalSDK to add paypal payment methods to the app I'm developing, it's already working and when the payment is succesful I'm getting a response which I'm converting into a jsonObject but I don't know how to parse it in order to extract just the code from the response. This is the response I'm getting JSON: [AnyHashable("response"): { code = "******************* -****************-**********************"; }, AnyHashable("response_type"): authorization_code, AnyHashable("client"): {

Firebase and swiftyJSON parsing

隐身守侯 提交于 2019-12-11 01:36:51
问题 swiftyJSON looks great for parsing Firebase. What would like to end up with is 2 possibilities: An imageName for one individual ID, and a list of imageName s for all IDs. JSON Struture: Code that retrieves JSON fine, but does not display imageName values: ref.observe(FIRDataEventType.value) { (snapshot: FIRDataSnapshot!) in let json = JSON(snapshot.value) // print("JSON: \(json)") // PRINT IMAGENAME - NOT WORKING if let imageName = json[12345][0]["imageName"].string { print("imageName: \

Use of undeclared type 'JSON' and use of unresolved identifier 'JSONEncoding'

て烟熏妆下的殇ゞ 提交于 2019-12-10 22:37:39
问题 I am having the above error on every file in my Xcode 8.2 project (swift 3) that require JSON or JSONEncoding. I already have SwiftyJSON in my pod files and imported it in those files. I already added it in the list of dependancies and links. here's and import example and an error example Any help to solve this issue would be greatly appreciated here are more examples from different swift files this errors says 'Could not infer type for 'arrFeeds'' this one is for use of undeclared type 'JSON

Use SwiftyJSON to deserialize NSDate

梦想与她 提交于 2019-12-10 17:49:07
问题 What is the best way to deserialize a JSON date into an NSDate instance using SwiftyJSON? Is it to just use stringValue with NSDateFormatter or is there a built in date API method with SwiftyJSON? 回答1: It sounds like NSDate support isn't built in to SwiftyJSON, but you can extend the JSON class with your own convenience accessors. The following code is adapted from this GitHub issue. extension JSON { public var date: NSDate? { get { if let str = self.string { return JSON.jsonDateFormatter

Create JSON Object from Class in Swift

我的未来我决定 提交于 2019-12-09 19:10:25
问题 I'm pretty new to iOS development and Swift (so please bear with me). I have a class object defined like this: class LocationPoint { var x: Double var y: Double var orientation: Double init(x: Double, y: Double, orientation: Double) { self.x = x self.y = y self.orientation = orientation } } In my delegate, I create an instance of the class and append it to an array (declared outside the delegate): var pt = LocationPoint(x: position.x, y: position.y, orientation: position.orientation) self