def encode(response)
      json = response.to_json
      [200,
       { Rack::CONTENT_TYPE => 'application/json',
         Rack::CONTENT_LENGTH => json.length.to_s },
       [json]]
    end
def encode(response)
      json = response.to_json
      [200,
       { Rack::CONTENT_TYPE => 'application/json',
         Rack::CONTENT_LENGTH => json.length.to_s },
       [json]]
    end
Encodes response appropriately by converting it to a JSON string.
 @param response [String, Hash, Array] response from format handler block.
 @return Rack response {Array}