Serialise to the wire format.
Map<String, Object?> toJson() => <String, Object?>{ 'input': input, 'steps': <Object?>[for (final step in steps) step.toJson()], 'output': output, };