Answer the question
In order to leave comments, you need to log in
How to set json response format from API on Rails 4?
You need to set the response format from the API in this form:
{
"errorCode": 0,
"errorMessage": "",
"result": [...]
}
def envelope(json, error_code=0, error_message='')
json.errorCode error_code
json.errorMessage error_message
json.set! :result, [1] do
yield if block_given?
end
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question