 
   /// Discard the next scalar field, advancing the pointer to the next field
   fileprivate func discardField() {
-    // FIXME: This can currently only discard scalar fields. Object fields
-    // should also be discardable
-    let fieldSize = readFieldLength()
-    pointer = pointer.advanced(by: fieldSize)
+    let (isObject, length) = readFieldLength()
+    if isObject {
+      // Discard object by discarding all its objects
+      for _ in 0..<length {
+        discardField()
+      }
+    } else {
+      // Discard scalar
+      pointer = pointer.advanced(by: length)
+    }
   }
 }
 

  fileprivate func read<T: ByteTreeScalarDecodable>(
    _ scalarType: T.Type
  ) -> T {
    let fieldSize = readFieldLength()
    defer {
      pointer = pointer.advanced(by: fieldSize)
    }

  fileprivate func read<T: ByteTreeObjectDecodable>(
    _ objectType: T.Type
  ) -> T {
    let numFields = readObjectLength()
    let objectReader = ByteTreeObjectReader(reader: self,
                                            numFields: numFields)
    return T.read(from: objectReader, numFields: numFields, userInfo: userInfo)
