Incorrect object structure

Jun 9, 2009 at 10:28 AM

Hi,

I am having trouble creating the correct object structure for the following line

{count:"2",tasks: [{estimatedtime:"72",ID:1},{estimatedtime:"26",ID:2}]}

I tried the following structure but i am getting an error

Public Class JsonTask
        Public count As String
        Public tasks As String()
End Class 

I am developing in vb.net but you can post in c# if you want, i'll translate it.

thanks in advance.

Jun 10, 2009 at 10:04 AM

Ok,

worked it out, just incase any other newbies to json need help on this here is what i did.

The structure for the above json line should look somthing like this:

 

    Public Class JsonTaskRecord
        Public estimatedtime As String
        Public ID As Integer
    End Class

    Public Class JsonTask
        Public count As String
        Public tasks As JsonTaskRecord()
    End Class