public HttpResponseMessage addBookDetails(BookDetails bookDetails) { ReturnData rd = new ReturnData(); rd = bookDetails.addBookDetails(); string yourJson = JsonConvert.SerializeObject(rd);; var response = this.Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(yourJson, Encoding.UTF8, "application/json"); return(response); }