             { return }
 
         do  {
-            let json = ["results": results.toJson["children"]!]
-            let jsonData = try JSONSerialization.data(withJSONObject: json, options: [])
+            let jsonData = try! JSONEncoder().encode(["results": results.children])
             try jsonData.write(to: URL(fileURLWithPath: "/tmp/siesta-spec-results.json"), options: [.atomic])
             }
         catch

        children.append(newChild)
        return newChild
        }

    var toJson: [String:Any]
        {
        var json: [String:Any] = ["name": name]
        if let callsite = callsite
            {
            json["file"] = callsite.file
            json["line"] = callsite.line
            }
        if let passed = passed
            { json["passed"] = passed }
        if !children.isEmpty
            { json["children"] = children.map { $0.toJson } }
        return json
        }
    }

        }
    }

private class Result: Codable
    {
    let name: String
    var file: String?
    var line: UInt?
    var passed: Bool?
    var children: [Result] = []

