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

  • SEARCH
  • Home
  • 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 8855745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:12:23+00:00 2026-06-14T14:12:23+00:00

I am trying to parse a Json String that is returned let is say

  • 0

I am trying to parse a Json String that is returned let is say from a service. For simplicity it will be like:

Dim jsonstring = _
<s>
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
  {"value": "New", "onclick": "CreateNewDoc()"},
  {"value": "Open", "onclick": "OpenDoc()"},
  {"value": "Close", "onclick": "CloseDoc()"}
]
}
}}
</s>.Value

Now I am using the following function to read the json string to an object however all the properties are always nothing. I have created an object for each json object in the above string and the object has Datacontract and Datamember attributes. Any tips please?

Dim menu = JsonObject(Of Menu)(jsonstring)
    Console.WriteLine(menu.value)

Private Function JsonObject(Of t)(jsonString As String) As t
    Dim ser As New DataContractJsonSerializer(GetType(t))
    Dim ms As New MemoryStream(Encoding.UTF8.GetBytes(jsonString))
    ms.Position = 0
    Dim obj As t = DirectCast(ser.ReadObject(ms), t)
    Return obj
End Function
  • 1 1 Answer
  • 0 Views
  • 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-06-14T14:12:24+00:00Added an answer on June 14, 2026 at 2:12 pm

    By looking at this call:

    Console.WriteLine(menu.value)
    

    I am suspecting that the Menu class is not defined correctly… Does your Menu class has a property called ‘menu’ and does the type of this ‘menu’ property is a complex type with the properties called ‘id’, ‘value’, ‘popup’?

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

Sidebar

Related Questions

I was trying to parse a JSON string from USGS . However I get
I;m trying to parse a json string which I receive from web server as
I am trying to parse a string which in JSON format only that keys
I am trying to create a JSONMessage class that can parse a json string
So I am trying to parse some JSON that is returned to me by
I have some JSON code in a string that I am trying to parse.
I am trying to parse a JSON string that is stored inside a cookie
I am trying to deserialize a JSON string that looks like so: {'type':'clientlist','client_list':[]} I
I have a JSON string (from PHP's json_encode() that looks like this: [{id: 1,
I am trying to parse the following JSON string remotely: [{name:Object1,data:[1,2]},{name:Object2,data:[3,4]}] I am doing

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.