Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6602937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:56:23+00:00 2026-05-25T18:56:23+00:00

I have some JSON data that looks like this: { data: [{ name:John Smith,

  • 0

I have some JSON data that looks like this:

{
    "data":
    [{
        "name":"John Smith",
        "id":"12345"
    }]
}

I have a pair of serializeable classes like so:

<Serializable()> _
Public Class User
    Private _name As String
    Private _id As String

    Public Property name() As String
        Get
            Return _name
        End Get
        Set(ByVal value As String)
            _name = value
        End Set
    End Property

    Public Property id() As String
        Get
            Return _id
        End Get
        Set(ByVal value As String)
            _id = value
        End Set
    End Property
End Class

<Serializable()>
Public Class UserData
    Private _data As List(Of User)

    Public Property data() As List(Of User)
        Get
            Return (_data)
        End Get

        Set(ByVal value As List(Of User))
            _data = value
        End Set
    End Property

End Class

When I try to deserialize as an object:

Dim serializer As New JavaScriptSerializer()
Dim userResult As Object = serializer.DeserializeObject(json)

I get one root object with key “data”, and value another object with 2 children, with keys “name” and “id”, and the appropriate values one might expect. But when I try to cast that object to my UserData type, it returns Nothing. I had this code working at some point, but now that I am returning to it and attempting to use it again, it seems some code rot has set in and it has stopped working.

Here is how I am attempting to get the deserialized data as a UserData object:

Dim userResult As UserData = TryCast(serializer.DeserializeObject(json), UserData)
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:56:23+00:00Added an answer on May 25, 2026 at 6:56 pm

    I was able to fix this issue by changing

    Dim userResult As UserData = TryCast(serializer.DeserializeObject(json), UserData)
    

    to

    Dim userResult As UserData = serializer.Deserialize(Of UserData)(json)
    

    Not exactly sure what the functional difference here is, but that got me the result i wanted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some JSON data that looks like this: { 910719: { id: 910719,
I have some JSON that looks like this: { ST: Security, C1: Login failures,
In my application I have some table data that looks like this: <table> <tr>
I have an object in Javascript that looks like this function MyObject(){ this.name=; this.id=0;
I have some JSON which looks generally like this... {appJSON: [ { title:Application Title,
Here's an interesting problem: I have some jQuery that looks like this: $(document).ready(function() {
I have an extremely simple JSON object that looks like the following: var data
I have a JSON string (from PHP's json_encode() that looks like this: [{id: 1,
I have some jQuery that looks like this: $.ajax({ type: POST, url: /problems/vote.php, dataType:
I have some JSON returned to the browser like this product: { Title: School

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.