     case string(String)
     case array(ArrayReader)
     case object(ObjectReader)
+
+    // Deeply inflate this ValueReader into a Value.
+    public var value: Value {
+        switch self {
+        case .integer(let i): return .integer(i)
+        case .double(let d): return .double(d)
+        case .null: return .null
+        case .bool(let b): return .bool(b)
+        case .string(let s): return .string(s)
+        case .array(let reader):
+            var result: [Value] = []
+            result.reserveCapacity(reader.count)
+            for element in reader {
+                result.append(element.value)
+            }
+            return .array(result)
+        case .object(let reader):
+            var result: [String: Value] = [:]
+            for (key, element) in reader {
+                result[key] = element.value
+            }
+            return .object(result)
+        }
+    }
 }
 
 // Encapsulates logic required to read from an array.

}

// Encapsulates logic required to read from an object.
public struct ObjectReader {
    fileprivate init(payload: UnsafePointer<UInt>, input: UnsafeBufferPointer<UInt8>) {
        self.payload = payload
        self.input = input
    }

    public subscript(key: String) -> ValueReader? {

import Foundation

// MARK: ValueReader

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