                 data = try self.encoder.encode(container)
             } else {
                 let container = try V1(pins: pins, mirrors: mirrors)
-                data = try self.encoder.encode(container)
+                let json = container.toLegacyJSON()
+                let bytes = json.toBytes(prettyPrint: true)
+                data = Data(bytes.contents)
             }
 #if !os(Windows)
             // rdar://83646952: add newline for POSIXy systems

                    throw StringError("invalid pin state: \(state)")
                }
            }
        }
    }


            )
        }

        // backwards compatibility of JSON format
        func toLegacyJSON() -> JSON {
            return .init([
                "version": self.version.toJSON(),
                "object": self.object.toLegacyJSON()
            ])
        }

        struct Container: Codable {
            var pins: [Pin]

            // backwards compatibility of JSON format
            func toLegacyJSON() -> JSON {
                return .init([
                    "pins": self.pins.map { $0.toLegacyJSON() },
                ])
            }
        }

        struct Pin: Codable {
