mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
16 lines
330 B
Ruby
16 lines
330 B
Ruby
module OpenFoodNetwork
|
|
module ApiHelper
|
|
def json_response
|
|
json_response = JSON.parse(response.body)
|
|
case json_response
|
|
when Hash
|
|
json_response.with_indifferent_access
|
|
when Array
|
|
json_response.map(&:with_indifferent_access)
|
|
else
|
|
json_response
|
|
end
|
|
end
|
|
end
|
|
end
|