HttpWebRequest:如何以JSON数组格式动态存储变量

时间:2017-05-15 09:31:04

标签: json vb.net

我的HttpWebRequest主体需要采用JSON数组格式,我必须在运行时动态填充它。

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"":[]}]}"

因此我需要将varTitlevarDescriptvarDescript等变量放入JSON数组中。我尝试以下方式做到这一点,但是没有用。

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"":[]}]}"

我从几个网站上读到了反序列化/序列化,但仍然无法实现我所寻找的目标。

0 个答案:

没有答案