Serialise to the wire format consumed by the extension.
Map<String, Object?> toJson() => <String, Object?>{ 'v': version, 'roots': <Object?>[for (final root in roots) root.toJson()], };