marshalJson function
Marshals a message to a Proto3 JSON string.
Converts the message map to Proto3 JSON using descriptor for field
type information. Field names are converted from snake_case to
lowerCamelCase. Default values are omitted per Proto3 convention.
Returns a compact JSON string.
Implementation
String marshalJson(
Map<String, Object?> message,
List<Map<String, Object?>> descriptor,
) {
final jsonMap = _marshalToMap(message, descriptor);
return jsonEncode(jsonMap);
}