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 8545511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:48:28+00:00 2026-06-11T12:48:28+00:00

I am using the following code snippet for a JSON request. <WebMethod(Description:=Gets the Categories)>

  • 0

I am using the following code snippet for a JSON request.

 <WebMethod(Description:="Gets the Categories")> _
    <ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
    Public Function GetCategories() As String
        Using ds As DataSet = db.ExecuteDataSet(CommandType.Text, "SELECT NodeID,NodeName FROM Nodes WHERE ParentID='1'")
            ' Create a multidimensional jagged array
            Dim JaggedArray As String()() = New String(ds.Tables(0).Rows.Count - 1)() {}
            Dim i As Integer = 0
            For Each rs As DataRow In ds.Tables(0).Rows
                JaggedArray(i) = New String() {rs("NodeName").ToString(), rs("NodeID").ToString()}
                i = i + 1
            Next

            ' Return JSON data
            Dim js As New JavaScriptSerializer()
            Dim strJSON As String = js.Serialize(JaggedArray)
            Return strJSON
        End Using
    End Function

Response I Get:

<string xmlns="http://localhost:54511/">
[["Books","BK01"],["Computers","CO01"],["Gaming","GA01"],["Mobile & Accessories","MO01"]]
</string>

Why dont i get the key??

Eg:

<string xmlns="http://localhost:54511/">
[{"nodename":"Books","nodeid":"BK01"},{"nodename":"Computers","nodeid":"CO01"},{"nodename":"Gaming","nodeid":"GA01"},{"nodename":"Mobile & Accessories","nodeid":"MO01"}]
</string>
  • 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-11T12:48:30+00:00Added an answer on June 11, 2026 at 12:48 pm

    That would be because you are serializing an array not an object, not very familiar with vb.net but I believe what you’re looking for is a Dictionary( Of String, String) and adding values to it as dictionary.add('nodename', rs("NodeName").ToString() … and so on

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

Sidebar

Related Questions

Here is the following code-snippet I'm using in my Google Spreadsheet onEdit() function: else
I am using the following code snippet to copy/backup database Public Sub backupData() Try
I am using the following code snippet in order to crop a image? function
I'm getting error using the following code snippet jQuery(document).ready(function() { jQuery.ajax({ url: url, type:
I am attempting to run the following code snippet: var myVar1 = $.getJSON('myurl', function(json)
I am using the following code snippet to calculate a total price. This works
I'm using the following code-snippet extensively in my model templates. <div class=control-group> @Html.LabelFor(model =>
From the book Groovy and Grails recipes I'm using the following code snippet: String
I have the following code snippet: using (SPSite site = new SPSite(this.ListAddress)) { using
The following is a Python code snippet using the ast and symtable packages. I

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.