    - Parameter _ object: An Any object.
    - Returns: A Data object if successful, nil otherwise.
    */
-  open class func serialize(_ object: Any, options: JSONSerialization.WritingOptions = []) -> Data? {
+  public static func serialize(_ object: Any, options: JSONSerialization.WritingOptions = []) -> Data? {
     guard JSONSerialization.isValidJSONObject(object) else {
       return nil
     }

   - Parameter index: An Int.
   - Returns: A GraphJSON object.
   */
  open subscript(index: Int) -> GraphJSON {
    guard let v = asArray else {
      return .isNil
    }

import Foundation

@dynamicMemberLookup
public struct GraphJSON: Equatable, CustomStringConvertible {
  
  /// A desiption of the object, used when printing.
  public var description: String {
    return GraphJSON.stringify(object, options: .prettyPrinted) ?? "{}"
  }
  
  /// A reference to the core object.
  public private(set) var object: Any
  
  /// A global GraphJSON object representing null.
  public static let isNil = GraphJSON(NSNull())
  
  /// An Array representation of the object.
  public var asArray: [Any]? {
    return object as? [Any]
  }
  
  /// A Dictionary representation of the object.
  public var asDictionary: [String: Any]? {
    return object as? [String: Any]
  }
  
  /// A String representation of the object.
  public var asString: String? {
    return object as? String
  }
  
  /// An Int representation of the object.
  public var asInt: Int? {
    return object as? Int
  }
  
  /// A Double representation of the object.
  public var asDouble: Double? {
    return object as? Double
  }
  
  /// A Float representation of the object.
  public var asFloat: Float? {
    return object as? Float
  }
  
  /// A Bool representation of the object.
  public var asBool: Bool? {
    return object as? Bool
  }
  
  /// A Data representation of the object.
  public var asNSData: Data? {
    return GraphJSON.serialize(object)
  }
  
