swiftyjson / swiftyjson Goto Github PK
View Code? Open in Web Editor NEWThe better way to deal with JSON data in Swift.
License: MIT License
The better way to deal with JSON data in Swift.
License: MIT License
Cool library!
Having trouble getting the right output from string input:
var json = JSONValue("{\"a\":\"b\"}") // (Enum Value)
json == JSONValue.JInvalid // false
json["a"].string // nil
I'm having challenges with JSONSerialization in swift, so downloaded this to try. It says source kit terminated famous XCode 6 message if I try to compile and run.
Would it be possible to add a paragraph in the README in regards to this?
how to transfer JSONValue object to Dictionary object?
What is the procedure to add a key value pair to a dictionary that is implemented using JSONValue?
Hey there,
I just updated Xcode for iOS 8.1 and this whole library just went BOOM. Just FYI.
I am following the example for looping through a JSON response. Creating the initial JSON object works and I am able to fetch properties. When I try to loop through the root Dictionary XCode complains that: Type 'JSON' does not conform to protocol 'SequenceType'
I am using Alamofire to make the HTTP request. Here is my response handler:
request.responseJSON { (request, response, data, error) in
let json = JSON(object: data!)
for (key: String, subJson: JSON) in json {
println(subJson)
}
}
switch json["val"]{
case .JString(let sval):
desLabel.text = sval
case .JNumber(let ival):
desLabel.text = ival.stringValue
case .JArray(let jval):
if let jname = jval[0]["name"].string{ //fatal error: Array index out of range
desLabel.text = jname
}
I think that returning errors forms these methods is absolutely unnecessary
Test failures on 32bit. When using the 4S simulator I get a could of test failures including this line:
XCTAssertEqual(JSON(2147483648).description,"2147483648")
Not sure that this can be resolved without forcing it to use Int64's but that will require annoying casts in other places.
I just forked your project. I used your code in my project
When i open my project with your file(SwiftyJSON.swift) in my Xcode6 Beta it gives me a error "Source Kit Service Terminated Editor functionality temporarily limited"
This causes my whole project syntax highlighting and code completion gone
Anyhow i will also try to solve this. But wanted to raise this as a issue.
In the latest updates of SwiftyJSON I have notice a decrease of speed, I tried to track what could it be, but found nothing, I tested the NSJSONSerialization alone and noticed that the problem is not there, what could it be?
Here is the JSON i'm using http://lvbp.meridiano.com.ve/ws/stats_json.aspx?metodo=Calendar&seasonId=29
Hi,
I am trying to get the string representation of a JSON object.
Given this example
let json:JSON = ["I":"am", "a":"json"]
println(json.stringValue)
I expect the println output to be ["I":"am", "a":"json"]
but it is nil. I have tried with other input data as well, but with the same result every time. the .string method is the same story.
Is the .string and .stringValue method broken, or am I using them wrong?
This is on the xcode6.1 branch by the way.
What I'm trying to do:
var JSONObject = JSON(data: data)
JSONObject["test"] = JSON("test")
It gives me the following error on the second line: " '@lvalue $T7' is not identical to 'JSON' "
What am I doing wrong?
I've got a framework where I have methods that take a JSONValue object like so:
public init(json: JSONValue) {
self.id = json["id"].integer!
// some other code
}
I need the class that contains this initializer to be within a framework in order to be able to use Live View functionality introduced with XCode 6. But as everything in SwiftyJSON is implicitly set to internal
access control level I receive the following error:
Initializer cannot be declared public because its parameter uses an internal type
var mydata = JSONValue(data)["videos"].array
let newdata = JSONValue(data)["videos1"].array
mydata.append(newdata) //it's error
how to add new JSONValue into exist JSONValue ?
Note: This is a specific problem when receiving HttpRequest Json data that is being formatted/Sent By .Net Web App into our iOS Apps.
So the problem is the format of .Net Json Formatter won't be the same when being read by the SwftyJson library since .Net has this special characters that .Net reads fine through them because IT knows them but Swift or Xcode don't recognize so it considers them as wrong data.
The characters in question are the following:
See in .Net, if you don't know already, requires the ' " ' to be able to create the correct JSon format. However when written in .Net and trying to parse it on Xcode is a problem because it sends NOT ONLY the double quotes but it sends the complete statement as " " " Which becomes a problem and crashes the SwiftyJson and well any other json in Xcode because the backslash becomes part of the unacceptable format.
Also .Net is so friendly with the whitespaces and leaves them there making in very few cases errors.
So I fixed it by Reading the NSData from the Httprequest like so:
var jsonstring: String = NSString(data: self.data as NSData,encoding: UInt())
next did my string replacement with the following Framework Method:
jsonstring.stringByReplacingOccurrencesOfString("\\", withString:"", options:NSStringCompareOptions.LiteralSearch, range: nil)
//Do the same for the white spaces.
and last recreate the NSData from the JsonString already parsed and patched:
var parseData: NSData? = (jsonstring as NSString).dataUsingEncoding(NSUTF16StringEncoding)//NSUTF8StringEncoding
You are done. Now use JsonValue like you normally would and it will all be perfect.
I think this could be related to other issues reported before, but this has been frustrating me since yesterday and it didn't solve, even after update to the latest version.
I don't understand why it is firing inside a specific point, and I have also other lines where I do the same and they are not firing anything.
searchReq = Alamofire.request(.GET, "https://maps.googleapis.com/maps/api/place/details/json", parameters:params)
.responseSwiftyJSON({ (req:NSURLRequest, response:NSHTTPURLResponse?, data:SwiftyJSON.JSON, error:NSError?) -> Void in
UIApplication.sharedApplication().networkActivityIndicatorVisible = false
if data != nil && data["status"] == "OK" {
println(data["result"]["formatted_address"])
if data["result"]["geometry"]["location"].dictionary != nil {
// This is the line that fires error
let coords:CLLocationCoordinate2D = CLLocationCoordinate2DMake(data["result"]["geometry"]["location"]["lat"],
data["result"]["geometry"]["location"]["lng"])
self.addPinToLocation(coords, title:self.selectedLocationHint?["description"] as String!, subtitle:"", focus:true)
}
}
})
I get a JSON response from a web service which looks like this.
{
"1":"Rooms",
"2":"Kitchen",
"3":"Bed1",
"4":"Bed2",
"5":"Bed3",
"6":"Master",
"7":"Breakfast",
"8":"Bath1",
"9":"Bath2",
"10":"Living"
}
As you can see it's a list of rooms. Each room has a number and a name. I have created a model class called Room with two properties for ID and Name.
Here is the method I call the web service to get the response.
public func getRooms(completionHandler: (response: [Room]?, error: NSError?) -> Void) {
let response = {(response: NSHTTPURLResponse!, data: HTTPHandler.Data!, error: NSError!) -> Void in
let json = JSONValue(data)
println(json["rooms"])
}
let httphandler = HTTPHandler.get("http://webservie.com/rooms", response: response)
}
I want to return an array of Room class objects. I get the JSON response to the json constant properly. How can I iterate through it and collect the objects into an array? I tried to do a for in loop on it but apparently its not possible.
Can someone please help me out?
Thank you.
It will silence a warning that dylib's can only be used on deployment targets >= 8.0
Many protocols implementaation are missing since Xcode 6.1
From my point of view, it's really annoying that all values are encoded and decoded as double
, in some cases this behaviour might be even buggy.
I propose to let caller side decide how to unwrap
returned Number - as Double, Int, whatever
I have a use case where I have an array of dictionaries and I need them as a json object:
var data = [Dictionary<String, String>]()
//append items
var bytes = NSJSONSerialization.dataWithJSONObject(data, options: NSJSONWritingOptions.allZeros, error: nil)
var jsonObj = JSON(NSString(data: bytes!, encoding: NSUTF8StringEncoding)!)
println(jsonObj)
println(jsonObj[0])
The first print statement gives me
[
{"price":"1.20","city":"Foo","_id":"326105","street":"One"},
{"price":"1.20","city":"Bar","_id":"326104","street":"Two"}
]
the second
null
but I would expect it to return the first element in the json array. What I am doing wrong?
Given that I have a JSON object, how do I get a NSData representation, which is suitable for sending over the network, with e.g. a POST request?
This is my json:
{"error":{"title":"Cannot login","message":"Username is required"}}
This is my code, the last println is never executed:
let json = JSONValue(response)
println(response)
if let userName = json["error"]["title"].string{
println(userName)
}
In "init (_ rawObject: AnyObject)" the "case let value as NSArray:" try to parse the array value in this line :
let jsonValue = JSONValue(possibleJsonValue)
if jsonValue {
jsonValues.append(jsonValue)
}
but when you have a null in the array no item is added. You have to do a code like that (with a else):
for possibleJsonValue : AnyObject in value {
let jsonValue = JSONValue(possibleJsonValue)
if jsonValue {
jsonValues.append(jsonValue)
} else {
jsonValues.append(JNull)
}
}
This is some good stuff! For the life of me ... I cannot see where I can grab the length of an array??
I've a compilation error relative SwiftyJSON, I've post my question on StackOverflow. Please have a look, thanks
If you add SwiftyJSON by dragging in the SwiftyJSON.xcodeproj then linking the framework and add a class like the following:
import SwiftyJSON
class Object {
func method(json: JSON) {
}
}
You'll get a segmentation fault
Please add it to Cocoapods.
Hi,
I'm using SwiftyJSON in a project where I'm using
println(boardsJSON["boards"])
to return the following JSON
[
{
"idOrganization":null,
"id":"5325aa22252e6dbe7bc6bf24",
"pinned":true,
"name":"Space Tiger",
"closed":false
},
{
"idOrganization":null,
"id":"53a6dd5e29abc0630ab317fa",
"pinned":true,
"name":"Work Stuff",
"closed":false
}
]
I can dive down the tree using something like
println(boardsJSON["boards"][0]["name"])
But if I wanted to iterate over all the names in my JSON how would I get the count of objects in the array?
@lingoer thanks for the push access!
I've added more tests and cleaned the code a little. I'll submit new issues and if they are minor enchacements/ bugs - fix the in place, otherwise discuss with you.
I think it's cool idea to have each protocol to be implemented in it's own extension - the code becomes more readable.
Hi, is there a way to update a JSON object? e.g
let json = JSON(data: dataFromNetworking)
json[0]["user"]["name"] = "new user name"
The following line is returning an error:
if let breadcrumb = userInfo["JSONErrorBreadCrumbKey"] as? String{
Error:
'String' is not a subtype of '(NSObject, AnyObject)'
Hi there,
I'm importing SwiftyJSON.swift into my project, but the compiler is flagging up 11 errors - mostly 'Type 'JSON' does not conform to protocol'' for the various LiteralConvertible protocols, and RawRepresentable.
I'm also getting a couple of errors on the line public init?(rawValue: AnyObject) {
- 'Expected '(' for initializer parameters' and 'Expected declaration'.
Do you have any plans on making it available as a cocoapod ?
I have received an error message in SwiftyJSON.swift:331:22: Use of undeclared type 'BooleanType'
extension JSONValue: BooleanType {
var boolValue: Bool {
switch self {
case .JInvalid:
return false
default:
return true
}
}
}
```case JNumber(Double)
case JString(String)
case JBool(Bool)
case JNull
case JArray(Array<JSONValue>)
case JObject(Dictionary<String,JSONValue>)
case JInvalid```
Now we have all the enum values prefixed with J
. It's unnecessary since collisions are impossible with swift enums.
Hii,
Ik have a question :) what do i wrong here? i get the error:
"use of unresolved identifier dataFromNetworking"
This is my code
Alamofire.request(.GET, "http://www.pasveer.nl/api/get_posts")
.responseJSON { (_, _, JSON, _) in
let json = JSON(data: dataFromNetworking)
if let userName = json[0]["user"]["name"].string{
println(userName)
else{
//something else
}
}
What am i doing wrong?
I've cloned the source, run Example project and apparently it's empty - no unit tests, no demo ๐ค
I have this this code:
var answers:JSON = JSON.nullJSON
answers["32"].string = answerFirstQuestion.text
answers["42"].string = answerSecondQuestion.text
answers["45"].string = answerThirdQuestion.text
print(answers)
var json:JSON = JSON.nullJSON
json["id"].string = identifier
json["resp"] = answers
println(json)
When I print both json these are null.
CompileSwift normal i386 com.apple.xcode.tools.swift.compiler
cd /Users/lebedzeu/src/git/SwiftyJSON/Example
export PATH="/Applications/Xcode6-Beta2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode6-Beta2.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -target i386-apple-ios8.0 -module-name Example -O0 -sdk /Applications/Xcode6-Beta2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -g -module-cache-path /Users/lebedzeu/Library/Developer/Xcode/DerivedData/ModuleCache -I /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Products/Debug-iphonesimulator -F /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Products/Debug-iphonesimulator -c -j4 /Users/lebedzeu/src/git/SwiftyJSON/Example/Example/ViewController.swift /Users/lebedzeu/src/git/SwiftyJSON/SwiftyJSON/SwiftJSON.swift /Users/lebedzeu/src/git/SwiftyJSON/Example/Example/AppDelegate.swift -output-file-map /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/i386/Example-OutputFileMap.json -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/i386/Example.swiftmodule -Xcc -iquote -Xcc /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Example-generated-files.hmap -Xcc -I/Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Example-own-target-headers.hmap -Xcc -I/Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Example-all-target-headers.hmap -Xcc -iquote -Xcc /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Example-project-headers.hmap -Xcc -I/Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Products/Debug-iphonesimulator/include -Xcc -I/Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/DerivedSources/i386 -Xcc -I/Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/DerivedSources -Xcc -DDEBUG=1 -emit-objc-header -emit-objc-header-path /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/i386/Example-Swift.h
0 swift 0x000000010352de08 llvm::sys::PrintStackTrace(__sFILE*) + 40
1 swift 0x000000010352e2f4 SignalHandler(int) + 452
2 libsystem_platform.dylib 0x00007fff82c3d5aa _sigtramp + 26
3 swift 0x00000001034ee7af llvm::FoldingSetImpl::FindNodeOrInsertPos(llvm::FoldingSetNodeID const&, void*&) + 175
4 swift 0x000000010295cdc9 swift::irgen::emitOpaqueExistentialContainerUpcast(swift::irgen::IRGenFunction&, swift::irgen::Address, swift::SILType, swift::irgen::Address, swift::SILType, bool) + 169
5 swift 0x000000010299ba8e swift::SILVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::ValueBase*) + 35406
6 swift 0x0000000102992846 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 8678
7 swift 0x0000000102913cd8 swift::irgen::IRGenModule::emitGlobalTopLevel() + 184
8 swift 0x000000010297fcc3 performIRGeneration(swift::IRGenOptions&, swift::Module*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 1859
9 swift 0x0000000102980613 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 51
10 swift 0x00000001028f295a frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 4842
11 swift 0x00000001028f165d main + 1533
12 libdyld.dylib 0x00007fff869765fd start + 1
13 libdyld.dylib 0x0000000000000036 start + 2036898362
Stack dump:
0. Program arguments: /Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/lebedzeu/src/git/SwiftyJSON/Example/Example/ViewController.swift -primary-file /Users/lebedzeu/src/git/SwiftyJSON/SwiftyJSON/SwiftJSON.swift /Users/lebedzeu/src/git/SwiftyJSON/Example/Example/AppDelegate.swift -enable-objc-attr-requires-objc-module -target i386-apple-ios8.0 -module-name Example -sdk /Applications/Xcode6-Beta2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -I /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Products/Debug-iphonesimulator -F /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Products/Debug-iphonesimulator -g -module-cache-path /Users/lebedzeu/Library/Developer/Xcode/DerivedData/ModuleCache -Xcc -iquote -Xcc /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Example-generated-files.hmap -Xcc -I/Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Example-own-target-headers.hmap -Xcc -I/Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Example-all-target-headers.hmap -Xcc -iquote -Xcc /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Example-project-headers.hmap -Xcc -I/Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Products/Debug-iphonesimulator/include -Xcc -I/Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/DerivedSources/i386 -Xcc -I/Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/DerivedSources -Xcc -DDEBUG=1 -emit-module-doc-path /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/i386/SwiftJSON~partial.swiftdoc -O0 -emit-module-path /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/i386/SwiftJSON~partial.swiftmodule -serialize-diagnostics-path /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/i386/SwiftJSON.dia -emit-dependencies-path /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/i386/SwiftJSON.d -o /Users/lebedzeu/Library/Developer/Xcode/DerivedData/Example-axvjsxtsdwewgkedabcaclklosug/Build/Intermediates/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/i386/SwiftJSON.o
1. While emitting IR SIL function @_TFO7Example9JSONValueCfMS0_FPSs9AnyObject_S0_ for 'init' at /Users/lebedzeu/src/git/SwiftyJSON/SwiftyJSON/SwiftJSON.swift:134:5
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)
Command /Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 254
Unfortunately my current project uses AFHTTPSessionManager in AFNetworking2
, so I can't use Alamofire. Does SwiftyJSON still work with AFHTTPSessionManager? If so, how can I call JSON from AFHTTPSessionManager
? I don't see NSData
exposed in success block.
I have the following block of code, how do I convert responseObject
, which can be downcasted to NSDictionary
, to a JSON object as defined in SwiftyJSON
? The code below doesn't work.
let task:NSURLSessionDataTask = AFHTTPSessionManager.GET(
url,
parameters: params,
success: { (task: NSURLSessionDataTask!, responseObject: AnyObject!) in
dispatch_async(dispatch_get_main_queue(), {
// How do I convert responseObject, which can be downcasted to NSDictionary to a JSON object?
let data = JSON(data: responseObject)
completion(task: task, response: data as JSON!, error: nil)
})
},
failure: { (task: NSURLSessionDataTask!, error: NSError!) in
dispatch_async(dispatch_get_main_queue(), {
completion(task: task, response: nil, error: error)
})
}
)
if i get a NSData (ex: load data from a file) when i pass it to JSONValue(var)
it always says that it's an invalid json object, which is not the case.
This is a hugely valuable project you created!
One huge issue I had in my last job was JSON nulls being returned by the web service. For instance, if someone had forgotten to set inventory, I'd get a null instead of zero. So I hacked up a category on NSNull so that I didn't have to test every single value before referencing it. The idea was that in most code, a zero would be just as useful as a null.
You can see others agree by the number of upvotes this answer got on SO: http://stackoverflow.com/a/16610117/1633251
What I am requesting is that you support an option that would result in no nulls being returned, with empty dictionaries, empty arrays, zero length strings, etc being returned instead.
If you want, I'll do the code and submit a pull request, but just tell me exactly how you want the option to work (and the actual string name if you care).
I am trying to achieve this:
func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {
let place = places![indexPath.row]
self.performSegueWithIdentifier("segue_order", sender: place)
}
I am getting error:
Type 'JSONValue' does not conform to protocol 'AnyObject'
When invocating a Swift protocol as Objective-C it fails due to the parameter type JSONValue cannot be represented in Objective-C
@objc protocol MyProtocol
{
optional func onResultsReceived( results: JSONValue ) <= *** This is going to fail ***
}
Is it possible to declare SwiftyJSON type inside @objc?
Thanks in advance
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.