Serialise to the wire format.
Map<String, Object?> toJson() => <String, Object?>{ 'depth': depth, 'canPop': canPop, 'entries': <Object?>[for (final entry in entries) entry.toJson()], };