0

I have my HttpWebRequest body that needs to be in JSON array format and I have to populate it dynamically at run time.

Dim body As String = "{""studentForm"":[{""title"":""Law Major"",""description"":""Excellent Student. Work hard. Very Intelligent, and so on..."",""phone"":""0123456789"",""categoryId"":1197,""categoryName"":""Senior Student"",""parentCategory"":9,""location"":{""latitude"":45.151053,""longitude"":-79.398193,""radius"":1000},""categoryAttributes"":[],""imageUrls"":[]}]}"

So I need to have variables like varTitle, varDescript, varDescript, and so on into the JSON array. I tried to do that the below way but doesn't work.

Dim body As String = "{""studentForm"":[{""title"":varTitle,""description"":varDescript,""phone"":varDescript,""categoryId"":1197,""categoryName"":""Senior Student"",""parentCategory"":9,""location"":{""latitude"":45.151053,""longitude"":-79.398193,""radius"":1000},""categoryAttributes"":[],""imageUrls"":[]}]}"

I read about Deserialization / Serialization from a couple of websites but still can't achieve what I'm looking for.

3
  • What are you trying to achieve doing this why not create a list of class and deserialize every json object to the list? Commented May 15, 2017 at 9:35
  • Is it possible? Will the data go to each field dynamically? I mean in runtime? If so, please show me how to do that? Commented May 15, 2017 at 11:02
  • stackoverflow.com/questions/20629812/… Commented May 15, 2017 at 11:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.