Changes done to NSJSONSerialization.swift to align with darwin code (#330)
diff --git a/Foundation/NSJSONSerialization.swift b/Foundation/NSJSONSerialization.swift
index d3422dc..6f3e0f1 100644
--- a/Foundation/NSJSONSerialization.swift
+++ b/Foundation/NSJSONSerialization.swift
@@ -96,7 +96,7 @@
     
     /* Generate JSON data from a Foundation object. If the object will not produce valid JSON then an exception will be thrown. Setting the NSJSONWritingPrettyPrinted option will generate JSON with whitespace designed to make the output more readable. If that option is not set, the most compact possible JSON will be generated. If an error occurs, the error parameter will be set and the return value will be nil. The resulting data is a encoded in UTF-8.
      */
-    public class func dataWithJSONObject(_ obj: AnyObject, options opt: NSJSONWritingOptions) throws -> NSData {
+    public class func data(withJSONObject obj: AnyObject, options opt: NSJSONWritingOptions = []) throws -> NSData {
         guard obj is NSArray || obj is NSDictionary else {
             throw NSError(domain: NSCocoaErrorDomain, code: NSCocoaError.PropertyListReadCorruptError.rawValue, userInfo: [
                 "NSDebugDescription" : "Top-level object was not NSArray or NSDictionary"
@@ -123,7 +123,7 @@
        The data must be in one of the 5 supported encodings listed in the JSON specification: UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE. The data may or may not have a BOM. The most efficient encoding to use for parsing is UTF-8, so if you have a choice in encoding the data passed to this method, use UTF-8.
      */
     /// - Experiment: Note that the return type of this function is different than on Darwin Foundation (Any instead of AnyObject). This is likely to change once we have a more complete story for bridging in place.
-    public class func JSONObjectWithData(_ data: NSData, options opt: NSJSONReadingOptions) throws -> Any {
+    public class func jsonObject(with data: NSData, options opt: NSJSONReadingOptions = []) throws -> Any {
         
         let bytes = UnsafePointer<UInt8>(data.bytes)
         let encoding: NSStringEncoding
@@ -161,7 +161,7 @@
     
     /* Create a JSON object from JSON data stream. The stream should be opened and configured. All other behavior of this method is the same as the JSONObjectWithData:options:error: method.
      */
-    public class func JSONObjectWithStream(_ stream: NSInputStream, options opt: NSJSONReadingOptions) throws -> AnyObject {
+    public class func jsonObject(with stream: NSInputStream, options opt: NSJSONReadingOptions = []) throws -> AnyObject {
         NSUnimplemented()
     }
 }
diff --git a/TestFoundation/TestNSJSONSerialization.swift b/TestFoundation/TestNSJSONSerialization.swift
index 83e87f1..a1b7a29 100644
--- a/TestFoundation/TestNSJSONSerialization.swift
+++ b/TestFoundation/TestNSJSONSerialization.swift
@@ -47,7 +47,7 @@
     func test_JSONObjectWithData_emptyObject() {
         let subject = NSData(bytes: UnsafePointer<Void>([UInt8]([0x7B, 0x7D])), length: 2)
         
-        let object = try! NSJSONSerialization.JSONObjectWithData(subject, options: []) as? [String:Any]
+        let object = try! NSJSONSerialization.jsonObject(with: subject, options: []) as? [String:Any]
         XCTAssertEqual(object?.count, 0)
     }
     
@@ -75,7 +75,7 @@
         ]
         
         for (description, encoded) in subjects {
-            let result = try? NSJSONSerialization.JSONObjectWithData(NSData(bytes:UnsafePointer<Void>(encoded), length: encoded.count), options: [])
+            let result = try? NSJSONSerialization.jsonObject(with: NSData(bytes:UnsafePointer<Void>(encoded), length: encoded.count), options: [])
             XCTAssertNotNil(result, description)
         }
     }
@@ -124,7 +124,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            let t = try NSJSONSerialization.JSONObjectWithData(data, options: [])
+            let t = try NSJSONSerialization.jsonObject(with: data, options: [])
             let result = t as? [String: Any]
             XCTAssertEqual(result?.count, 0)
         } catch {
@@ -140,7 +140,7 @@
                     XCTFail("Unable to convert string to data")
                     return
                 }
-                let result = try NSJSONSerialization.JSONObjectWithData(data, options: []) as? [String: Any]
+                let result = try NSJSONSerialization.jsonObject(with: data, options: []) as? [String: Any]
                 XCTAssertEqual(result?["hello"] as? String, "world")
                 XCTAssertEqual(result?["swift"] as? String, "rocks")
             }
@@ -158,7 +158,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            let result = try NSJSONSerialization.JSONObjectWithData(data, options: []) as? [Any]
+            let result = try NSJSONSerialization.jsonObject(with: data, options: []) as? [Any]
             XCTAssertEqual(result?.count, 0)
         } catch {
             XCTFail("Unexpected error: \(error)")
@@ -174,7 +174,7 @@
                     XCTFail("Unable to convert string to data")
                     return
                 }
-                let result = try NSJSONSerialization.JSONObjectWithData(data, options: []) as? [Any]
+                let result = try NSJSONSerialization.jsonObject(with: data, options: []) as? [Any]
                 XCTAssertEqual(result?[0] as? String, "hello")
                 XCTAssertEqual(result?[1] as? String, "swift⚡️")
             }
@@ -193,7 +193,7 @@
                     XCTFail("Unable to convert string to data")
                     return
                 }
-                let result = try NSJSONSerialization.JSONObjectWithData(data, options: []) as? [Any]
+                let result = try NSJSONSerialization.jsonObject(with: data, options: []) as? [Any]
                 XCTAssertEqual(result?[0] as? String, "unicode")
                 XCTAssertEqual(result?[1] as? String, "Ģ")
                 XCTAssertEqual(result?[2] as? String, "😢")
@@ -213,7 +213,7 @@
                     XCTFail("Unable to convert string to data")
                     return
                 }
-                let result = try NSJSONSerialization.JSONObjectWithData(data, options: []) as? [Any]
+                let result = try NSJSONSerialization.jsonObject(with: data, options: []) as? [Any]
                 XCTAssertEqual(result?[0] as? Bool, true)
                 XCTAssertEqual(result?[1] as? Bool, false)
                 XCTAssertEqual(result?[2] as? String, "hello")
@@ -236,7 +236,7 @@
                     XCTFail("Unable to convert string to data")
                     return
                 }
-                let result = try NSJSONSerialization.JSONObjectWithData(data, options: []) as? [Any]
+                let result = try NSJSONSerialization.jsonObject(with: data, options: []) as? [Any]
                 XCTAssertEqual(result?[0] as? Double,     1)
                 XCTAssertEqual(result?[1] as? Double,    -1)
                 XCTAssertEqual(result?[2] as? Double,   1.3)
@@ -257,7 +257,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            let res = try NSJSONSerialization.JSONObjectWithData(data, options: []) as? [Any]
+            let res = try NSJSONSerialization.jsonObject(with: data, options: []) as? [Any]
             let result = res?.flatMap { $0 as? String }
             XCTAssertEqual(result?[0], "\"")
             XCTAssertEqual(result?[1], "\\")
@@ -279,7 +279,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            let result = try NSJSONSerialization.JSONObjectWithData(data, options: []) as? [Any]
+            let result = try NSJSONSerialization.jsonObject(with: data, options: []) as? [Any]
             XCTAssertEqual(result?[0] as? String, "✨")
         } catch {
             XCTFail("Unexpected error: \(error)")
@@ -293,7 +293,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            let result = try NSJSONSerialization.JSONObjectWithData(data, options: []) as? [Any]
+            let result = try NSJSONSerialization.jsonObject(with: data, options: []) as? [Any]
             XCTAssertEqual(result?[0] as? String, "\u{1D11E}")
         } catch {
             XCTFail("Unexpected error: \(error)")
@@ -309,7 +309,7 @@
                     XCTFail("Unable to convert string to data")
                     return
                 }
-                let result = try NSJSONSerialization.JSONObjectWithData(data, options: .AllowFragments) as? Double
+                let result = try NSJSONSerialization.jsonObject(with: data, options: .AllowFragments) as? Double
                 XCTAssertEqual(result, 3)
             }
         } catch {
@@ -326,7 +326,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            try NSJSONSerialization.JSONObjectWithData(data, options: [])
+            try NSJSONSerialization.jsonObject(with: data, options: [])
             XCTFail("Expected error: UnterminatedString")
         } catch {
             // Passing case; the object as unterminated
@@ -341,7 +341,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            try NSJSONSerialization.JSONObjectWithData(data, options: [])
+            try NSJSONSerialization.jsonObject(with: data, options: [])
             XCTFail("Expected error: Missing key for value")
         } catch {
             // Passing case; the key was missing for a value
@@ -356,7 +356,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            try NSJSONSerialization.JSONObjectWithData(data, options: [])
+            try NSJSONSerialization.jsonObject(with: data, options: [])
             XCTFail("Expected error: Unexpected end of file")
         } catch {
             // Success
@@ -371,7 +371,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            try NSJSONSerialization.JSONObjectWithData(data, options: [])
+            try NSJSONSerialization.jsonObject(with: data, options: [])
             XCTFail("Expected error: Invalid value")
         } catch {
             // Passing case; the value is invalid
@@ -386,7 +386,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            try NSJSONSerialization.JSONObjectWithData(data, options: [])
+            try NSJSONSerialization.jsonObject(with: data, options: [])
             XCTFail("Expected error: Invalid value")
         } catch {
             // passing case the value is invalid
@@ -401,7 +401,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            try NSJSONSerialization.JSONObjectWithData(data, options: [])
+            try NSJSONSerialization.jsonObject(with: data, options: [])
             XCTFail("Expected error: Invalid value")
         } catch {
             // Passing case; the element in the array is missing
@@ -416,7 +416,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            try NSJSONSerialization.JSONObjectWithData(data, options: [])
+            try NSJSONSerialization.jsonObject(with: data, options: [])
             XCTFail("Expected error: Badly formed array")
         } catch {
             // Passing case; the array is malformed
@@ -431,7 +431,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            try NSJSONSerialization.JSONObjectWithData(data, options: [])
+            try NSJSONSerialization.jsonObject(with: data, options: [])
             XCTFail("Expected error: Invalid escape sequence")
         } catch {
             // Passing case; the escape sequence is invalid
@@ -445,7 +445,7 @@
                 XCTFail("Unable to convert string to data")
                 return
             }
-            try NSJSONSerialization.JSONObjectWithData(data, options: []) as? [String]
+            try NSJSONSerialization.jsonObject(with: data, options: []) as? [String]
             XCTFail("Expected error: Missing Trailing Surrogate")
         } catch {
             // Passing case; the unicode character is malformed
@@ -579,7 +579,7 @@
     }
 
     func trySerialize(_ obj: AnyObject) throws -> String {
-        let data = try NSJSONSerialization.dataWithJSONObject(obj, options: [])
+        let data = try NSJSONSerialization.data(withJSONObject: obj, options: [])
         guard let string = NSString(data: data, encoding: NSUTF8StringEncoding) else {
             XCTFail("Unable to create string")
             return ""