Page 1 of 1

How to encode an array in json?

Posted: Sun Dec 13, 2015 2:28 pm
by KraZy
Hi there,


I'm a bit rusty with vb.net and I need your help for encoding this:
Code: Select all
{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"saturday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"sunday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]}}
in json format in vb.net, how you can see this string is already decoded in json but I want know how I can create an array or something like for store the days with the break time. Essentially:
Code: Select all
"monday":{
"start":"09:00",
"end":"18:00",
"breaks":[
{
"start":"11:20",
"end":"11:30"
},
{
"start":"14:30",
"end":"15:00"
}
]
},
"tuesday":{
"start":"09:00",
"end":"18:00",
"breaks":[
{
"start":"11:20",
"end":"11:30"
},
{
"start":"14:30",
"end":"15:00"
}
]
},
Someone could help me to create the array with this contents and convert it into json? Thanks.

Re: How to encode an array in json?

Posted: Mon Dec 14, 2015 11:56 pm
by MrGeneralQ
Vb.net doesnt support json
You can still do it but iets nearly impossible.
Json is for PHP or Java

Re: How to encode an array in json?

Posted: Tue Dec 15, 2015 9:22 am
by visualtech
I am sorry, but you're utterly wrong here MrGeneralQ. VB.NET does support JSON, but with a library. You can very easily do it in VB.NET. Lastly, JSON is for Ruby, PHP, Python or any other language. It was essentially drafted for backends since it was easier and faster than XML. Since Java, PHP are mainly backend languages, it would've been wise to include the JSON engine. For VB.NET, that wasn't the case; so, libraries.

Re: How to encode an array in json?

Posted: Tue Dec 15, 2015 7:10 pm
by CodenStuff
This topic may help:
http://www.codenstuff.com/forum/viewtop ... 38&t=11520

Also I'll respond to PM's when I have time to get through them.

Re: How to encode an array in json?

Posted: Tue Dec 15, 2015 7:18 pm
by KraZy
CodenStuff wrote:
This topic may help:
http://www.codenstuff.com/forum/viewtop ... 38&t=11520

Also I'll respond to PM's when I have time to get through them.
Okay I've fixed with the .JSON library, anyway, let me update for the pv message it's important