JSON Deserialization in asp.net VB

I can not seem to get  json deserialization to work correctly in asp.net vb
the problem seems to be in the type casting.
The JSON string represents an array of (skill_ser) which itself contains several arrays of (skill_ser)
Thank you for your help!
The data class:
<DataContract()> Class skill_ser
    <DataMember()> Public i As Integer
    <DataMember()> Public n As String
    <DataMember()> Public p As Integer
    <DataMember()> Public s() As skill_ser
    <DataMember()> Public a() As skill_ser
End Class
 
The code:
    Protected Sub writeSkills(ByVal Jskill As String)
        Dim skills As skill_ser()
        Dim stream As MemoryStream
        stream = New MemoryStream(Encoding.Unicode.GetBytes(Jskill))
        Dim JSC As DataContractJsonSerializer
        JSC = New DataContractJsonSerializer(GetType(skill_ser))
        skills = CType(JSC.ReadObject(stream), skill_ser())
        dexterity.InnerText = skills(1).p
    End Sub

Open in new window

apocalypse910Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Refael AckermannCommented:
I believe the problem is that your trying to cast the deserialized object to an array of skill_ser, while you create a serializer for a single skill_ser.
You could either create a deserializer for "skill_ser()", or read the objects one at time.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
apocalypse910Author Commented:
Gah! - I found the problem.

I didn't realize that I had structured the data as an array of an array of skill_ser. rather than what i stated. (ah the dangers of programming while sick and half asleep.  Points awarded because you were right as well. Sorry again for the stupidity and incorrect information. Thanks again!
0
Refael AckermannCommented:
Always happy to assist.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.