     init() {}
 
     private mutating func appendFieldName(name: StaticString, inExtension: Bool) {
-        for _ in 0..<tabLevel {
-            data.append(asciiSpace)
-            data.append(asciiSpace)
-        }
+        data.append(contentsOf: indent)
         if inExtension {
             data.append(asciiOpenSquareBracket)
         }

    }

    mutating func startObject() {
        tabLevel += 1
        data.append(asciiOpenCurlyBracket)
        data.append(asciiNewline)
    }

    mutating func endObject() {
        tabLevel -= 1
        for _ in 0..<tabLevel {
            data.append(asciiSpace)
            data.append(asciiSpace)
        }
        data.append(asciiCloseCurlyBracket)
    }


private let asciiLowerT = UInt8(ascii: "t")
private let asciiLowerV = UInt8(ascii: "v")

private let tabSize = 2

/// TextFormatEncoder has no public members.
internal struct TextFormatEncoder {
    private var data = [UInt8]()
    private var indent: [UInt8] = []
    var stringResult: String {
        get {
            return String(bytes: data, encoding: String.Encoding.utf8)!
