Method: FunctionsFramework::CloudEvents::JsonFormat#encode

Defined in:
lib/functions_framework/cloud_events/json_format.rb

#encode(event, sort: false, **_other_kwargs) ⇒ String

Encode an event to a JSON string.

Parameters:

Returns:

  • (String)

    The JSON representation.



46
47
48
49
50
# File 'lib/functions_framework/cloud_events/json_format.rb', line 46

def encode event, sort: false, **_other_kwargs
  structure = encode_hash_structure event
  structure = sort_keys structure if sort
  ::JSON.dump structure
end