Swift extension: Dictionary to JSON string for URL parameter
Your dictionary to JSON converter has some serious issues:


The special characters " and \in strings are not properly escaped:

[ "a\"b" : "c\\d"].toJSONString()


produces "{"a"b":"c\d"}", correct would be {"a\"b":"c\\d"} 
(see for example http://json.org).
Only arrays of strings are implemented, but not arrays of numbers
or arrays of arrays or dictionaries.
Value types which are not covered by your code just print as an
empty string instead of causing an error. 
Boolean values are simply treated as numbers:

[ "key" : true].toJSONString()


gives {"key":1}, correct would be {"key":true}


While this could all be fixed, it probably isn't worth the effort
because there is a Foundation class NSJSONSerialization which already
does exactly this:

var dict : [String: AnyObject] = [:]
dict["a\"b"] = "c\\d"
dict["strings"] = ["string", "another"]
dict["keywdict"] = [ "anotherKey": 100, "Key2": "Val2"]
dict["numbers"] = [ 1, 2, 3]
dict["bools"] = [ true, false]

var error : NSError?
if let jsonData = NSJSONSerialization.dataWithJSONObject(dict, options: nil, error: &amp;error) {
    let jsonString = NSString(data: jsonData, encoding: NSUTF8StringEncoding)! as String
    println(jsonString)
} else {
    println("Error in JSON conversion: \(error!.localizedDescription)")
}


Output:


{"keywdict":{"anotherKey":100,"Key2":"Val2"},"bools":[true,false],"a\"b":"c\\d","strings":["string","another"],"numbers":[1,2,3]}