Module: Datadog::Core::Encoding::JSONEncoder

Extended by:
Encoder
Defined in:
lib/datadog/core/encoding.rb

Overview

Encoder for the JSON format

Constant Summary collapse

CONTENT_TYPE =
'application/json'

Class Method Summary collapse

Class Method Details

.content_typeObject



44
45
46
# File 'lib/datadog/core/encoding.rb', line 44

def content_type
  CONTENT_TYPE
end

.decode(obj) ⇒ Object



52
53
54
# File 'lib/datadog/core/encoding.rb', line 52

def decode(obj)
  JSON.parse(obj)
end

.encode(obj) ⇒ Object



48
49
50
# File 'lib/datadog/core/encoding.rb', line 48

def encode(obj)
  JSON.dump(obj)
end

.join(encoded_data) ⇒ Object



56
57
58
# File 'lib/datadog/core/encoding.rb', line 56

def join(encoded_data)
  "[#{encoded_data.join(',')}]"
end