public HttpResponseMessage getBookDetailsFromBookID(string bookID) { List <BookDetails> list = new List <BookDetails>(); BookDetails u = new BookDetails(); list = u.getBookDetailsFromBookID(bookID); string yourJson = JsonConvert.SerializeObject(list); var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }