fixed api to return proper json