Search This Blog

Tuesday, October 22, 2019

C# Controller - accept any json in POST (not typed)

in case you want to get any json string (not typed) , you can try the next code snippets

             [HttpPost]
        public ActionResult Bot(string request)
        {
            Request.InputStream.Position = 0;
            var input = new StreamReader(Request.InputStream).ReadToEnd();

            JObject json = JObject.Parse(input);
           ...........
       }

No comments: