Questions tagged [swifty-json]

SwiftyJSON is a tool to simplify handling JSON data in Swift.

SwiftyJSON is a tool to simplify handling JSON data in Swift.


Useful links


Related tags

1020 questions
11
votes
4 answers

SwiftyJSON looping through an array of JSON objects

[ { "cont": 9714494770, "id": "1", "name": "Kakkad" }, { "cont": 9714494770, "id": "2", "name": "Ashish" } ] The one above is a json array filled with JSON objects. I don't know how to…
gwhiz
  • 613
  • 1
  • 4
  • 9
10
votes
2 answers

How to save/retrieve dictionary from file using SwiftyJSON

I'm trying to make the conversion from Objc to swift and have had better days. I have a class with a dictionary: collaborationDictionary:[String:Set] I am trying to write/read this dictionary to/from a file and just can't quite seem to…
JustLearningAgain
  • 2,227
  • 4
  • 34
  • 50
10
votes
2 answers

Convert a simple string to JSON String in swift

I know there is a question with same title here. But in that question, he is trying to convert a dictionary into JSON. But I have a simple sting like this: "garden" And I have to send it as JSON. I have tried SwiftyJSON but still I am unable to…
iBug
  • 2,334
  • 3
  • 32
  • 65
10
votes
2 answers

How can I rewrite this function so that it uses SwiftyJSON instead of JSON.swift?

I'm looking at the Ray Wenderlich tutorial http://www.raywenderlich.com/90971/introduction-mapkit-swift-tutorial and he is using there this function: class func fromJSON(json: [JSONValue]) -> Artwork? { // 1 var title: String if let titleOrNil…
user3766930
  • 5,629
  • 10
  • 51
  • 104
10
votes
1 answer

SwiftyJSON: Converting Objects to JSON

I know with SwiftyJSON you can convert the objects from JSON to Swift. Does SwiftyJSON allows you to go back? i.e. take NSManagedObjects with relationships and converting them it into JSON? Example Please.
user1107173
  • 10,334
  • 16
  • 72
  • 117
10
votes
4 answers

How do I use SwiftyJSON in my iOS App?

I recently added SwiftyJSON into my xCode project using Carthage. Cartfile $ cat Cartfile github "SwiftyJSON/SwiftyJSON" >= 2.1.2 I ran this command to install SwiftyJSON $ carthage update I added the built Framework to my xCode project I…
andrew nguyen
  • 513
  • 8
  • 19
10
votes
6 answers

JSON encoding with backslashes

I m using Alamofire and SwiftyJSOn to parse JSON output. It works very well however some sites give json with escaped output. I use Alamofire like below Alamofire.request(.POST, url, parameters: param, encoding: .JSON) .responseJSON {…
Meanteacher
  • 2,031
  • 3
  • 17
  • 48
9
votes
3 answers

'The 'Pods' target has transitive dependencies that include static binaries' when installing 'Google-Maps-iOS-Utils'

I am trying to install 'Google-Maps-iOS-Utils' but it gives me above error. Here is Podfile : platform :ios, '9.0' use_frameworks! target 'MapClusters' do pod 'Alamofire' pod 'SwiftyJSON' pod 'GoogleMaps' pod…
9
votes
4 answers

Is SwiftyJson capable of converting a custom swift class to a json string?

Given below is my custom swift class. My Question is how to convert an object of this class to a json string using SwiftyJson? class Equipment{ var UniqueItemId:String? = "" var ItemNo:String? = "" var EquipmentType:String? = "" …
Asanga Dewaguru
  • 1,058
  • 2
  • 16
  • 31
9
votes
1 answer

Carthage setup fails with code 65

I'm installing carthage on a new machine. $ brew install Carthage [in project root] $ emacs Cartfile # Alamofire github "Alamofire/Alamofire" # SwifyJSON github "SwiftyJSON/SwiftyJSON" $ carthage update *** Fetching SwiftyJSON *** Fetching…
Marcus
  • 9,032
  • 11
  • 45
  • 84
9
votes
3 answers

How to retrieve data from file with SwiftyJSON

I have added a JSON-file to my file-system where the data is structured like this: { "DDD" : "3D Systems Corporation", "MMM" : "3M Company", "WBAI" : "500.com Limited", "WUBA" : "58.com Inc.", "AHC" : "A.H. Belo Corporation", "ATEN" : "A10…
joseph
  • 897
  • 2
  • 10
  • 20
8
votes
1 answer

SwiftyJson - Remove empty elements from array

I have an array from JSON response. In this array from 0-20 positions. In every position can be an image or video. From the cycle I get the urls with images and videos. Sometimes I had 8 images and 2 videos, But had response - 8 urls of images, 2…
Woop
  • 99
  • 2
  • 11
8
votes
1 answer

Cannot subscript a value of type 'JSON' with an index of type 'STRING'

This was working in Swift2 but now in Swift3 (after automatic conversion) I'm getting an error: if self.entry["scheduler"] || self.entry["owner"] Cannot subscript a value of type 'JSON' with an index of type 'STRING' The values of…
Works for a Living
  • 1,262
  • 2
  • 19
  • 44
8
votes
5 answers

Swift safely unwrapping optinal strings and ints

When I am about to fire my segue for the 2nd view I also send some values like this: if let aTime = ads[indexPath.row]["unix_t"].int { toView.time = aTime } if let aTitle = ads[indexPath.row]["title"].string { toView.title = aTitle } In…
user2636197
  • 3,982
  • 9
  • 48
  • 69
8
votes
2 answers

How can I print the json content of the response from post request in Alamofire in swift?

Ok, so I'm using alamofire and the parameters I'm passing are valid. Here is the code so far: Alamofire.request(.POST, "http://mywebservice.com", parameters: myparameters) .response { (request, response, data, error) in if(error != nil){ …
randomuser1
  • 2,733
  • 6
  • 32
  • 68
1
2
3
67 68