         return result
     }
 
+    // MARK: Sequence
+
+    public struct Iterator: IteratorProtocol {
+        fileprivate init(objectReader: ObjectReader) {
+            self.objectReader = objectReader
+        }
+
+        public mutating func next() -> (String, ValueReader)? {
+            if currentIndex < objectReader.count {
+                let value = objectReader[currentIndex]
+                currentIndex += 1
+                return value
+            } else {
+                return nil
+            }
+        }
+
+        private var currentIndex = 0
+        private let objectReader: ObjectReader
+    }
+    
+    public func makeIterator() -> ObjectReader.Iterator {
+        return Iterator(objectReader: self)
+    }
+
     // MARK: Private
 
     private let payload: UnsafePointer<UInt>
     private let input: UnsafeBufferPointer<UInt8>
 }
 
+// MARK: Value
+
+/// Represents a fully-decoded JSON parse tree.  This API is provided for convenience, but for
+/// optimal performance, consider using `ValueReader` instead.
+public enum Value {
+    case integer(Int32)
+    case double(Float64)
+    case null
+    case bool(Bool)
+    case string(String)
+    case array([Value])
+    case object([String: Value])
+}
+
 // Internal type that represents a decodable sajson AST node.
 private struct ASTNode {
+    // Keep this in sync with sajson::type
+    private struct RawType {
+        static let integer: UInt8 = 0
+        static let double: UInt8 = 1
+        static let null: UInt8 = 2
+        static let bfalse: UInt8 = 3
+        static let btrue: UInt8 = 4
+        static let string: UInt8 = 5
+        static let array: UInt8 = 6
+        static let object: UInt8 = 7
+    }
+    
     fileprivate init(type: UInt8, payload: UnsafePointer<UInt>, input: UnsafeBufferPointer<UInt8>) {
         self.type = type
         self.payload = payload

import Foundation

// Keep this in sync with sajson::type
private struct RawValueType {
    static let integer: UInt8 = 0
    static let double: UInt8 = 1
    static let null: UInt8 = 2
    static let bfalse: UInt8 = 3
    static let btrue: UInt8 = 4
    static let string: UInt8 = 5
    static let array: UInt8 = 6
    static let object: UInt8 = 7
}

/// Represents a JSON value decoded from the sajson AST.  This type provides decoded access
/// to array and object elements lazily.

        return cb(rootNode.valueReader)
    }

    /// Decodes the entire document into a Swift `Value` tree.
    /// This accessor is convenient, but for optimum performance, use `withRootValueReader` instead.
    var rootValue: Value {
        return withRootValueReader { rootReader in
            return rootReader.value
        }
    }

    // MARK: Private

    private let rootNode: ASTNode
