This is my code in php:
$posts = array();
for ($row = 2; $row <4; $row++) {
$post= array();
$post["series"]= 1;
$post["modelno"]= 2;
$posts[] = array('Item'=>$post);
}
$json=json_encode(json_encode(array('table1'=>$posts)));
Result:
"{\"table1\":[{\"Item\":{\"series\":1,\"modelno\":2}},{\"Item\":{\"series\":1,\"modelno\":2}}]}"
I want convert this process to vb.net: My code by vb.net:
Dim jarray As New JArray
For i = 2 To 3
Dim ji As New JObject
ji("series") = 1
ji("modelno") = 2
jarray.Add(ji)
Next
Dim jData = New JObject
jData("table1") = jarray
Dim strJson = jData.ToString
This is result in vb.net:
{
"table1": [
{
"series": 1,
"modelno": 2
},
{
"series": 1,
"modelno": 2
}
]
}
I have 2 the problem in vb.net:
How can add name Item
to json object.
How encode the same php.
Thank you.