I am working on a ruby API's.This API fetching db value and converted into a JSON format.
Below code used to fetch data from db and converted into JSON format
def get_data
response= data.select(:xx, :xxx, :xxx, :xxx ).where(:id => xxx1,:xx1 => xx1)
if response.empty?
respond_to do |format|
msg = {:message => "No records found"}
format.json { render :json => msg }
end
else
respond_to do |format|
format.json { render json: response.to_json }
end
end
end
Now am getting the response like below
How can i remove the slash from the response? Thanks in advance.
Note: I was tested this API's from POSTMAN
Executed following solutions but the result was same
use
as_json
instead ofto_json
removed
.to_json