• Top Members
    Reps
    Posts
  • 834 Replies
    2585 Replies
  • 716 Replies
    2025 Replies
  • 331 Replies
    1928 Replies

How to encode an array in json?

Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
User avatar
KraZy
Top Poster
Posts: 93

How to encode an array in json?

Sun Dec 13, 2015 3:28 pm

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.
I'm in the empire business.

User avatar
MrGeneralQ
New Member
Posts: 16

Re: How to encode an array in json?

Tue Dec 15, 2015 12:56 am

Vb.net doesnt support json
You can still do it but iets nearly impossible.
Json is for PHP or Java

User avatar
visualtech
VIP - Donator
Posts: 265

Re: How to encode an array in json?

Tue Dec 15, 2015 10:22 am

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.
Image

User avatar
CodenStuff
Site Admin
Posts: 4367

Re: How to encode an array in json?

Tue Dec 15, 2015 8:10 pm

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.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.

User avatar
KraZy
Top Poster
Posts: 93

Re: How to encode an array in json?

Tue Dec 15, 2015 8:18 pm

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
I'm in the empire business.

Post Reply

Return to “Tutorial Requests”