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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:17:32+00:00 2026-05-24T23:17:32+00:00

I am having a heck of a time with some very simple json and

  • 0

I am having a heck of a time with some very simple json and was hoping someone could help. I have a very basic VB.NET webform which which writes out the contents of a datatable serizlized with JavaScriptSerializer.

        Using conn As New SqlConnection(connStr)
        Using command As New SqlCommand("select * from stategeopositions", conn)
            conn.Open()
            Using reader As SqlDataReader = command.ExecuteReader()
                dt.TableName = "states"
                dt.Load(reader)
                conn.Close()
            End Using
        End Using
    End Using

    Dim objs As New List(Of Dictionary(Of String, Object))
    For Each row As DataRow In dt.Rows
        Dim drow As New Dictionary(Of String, Object)
        For i As Integer = 0 To dt.Columns.Count - 1
            drow.Add(dt.Columns(i).ColumnName, row(i))
        Next
        objs.Add(drow)
    Next

    Dim d As New Dictionary(Of String, Object)
    d.Add(dt.TableName, objs)

    Dim serialier As New JavaScriptSerializer

    Response.Write(serialier.Serialize(d))

On the jquery side I am doing this.

            $.ajax({
            type: "GET",
            url: 'StateGeoPositions.aspx',
            async: false,
            beforeSend: function (x) {
                if (x && x.overrideMimeType) {
                    x.overrideMimeType("application/j-son;charset=UTF-8");
                }
            },
            dataType: "json",
            success: function (data) {
                alert(data);
                //do your stuff with the JSON data
            },
            error: function (xhr, ajaxOptions, thrownError) {
                alert(xhr.status);
                alert(thrownError);
            }
        });

This is returning “invalid json”

Here is the output

{“states”:[{“state”:”Alaska”,”abbreviation”:”AK”,”latitude”:61.370717,”longitude”:-152.404420,”small”:null},{“state”:”Alabama”,”abbreviation”:”AL”,”latitude”:32.806673,”longitude”:-86.791133,”small”:null},{“state”:”Arkansas”,”abbreviation”:”AR”,”latitude”:34.969705,”longitude”:-92.373124,”small”:null},{“state”:”Arizona”,”abbreviation”:”AZ”,”latitude”:33.729761,”longitude”:-111.431224,”small”:null},{“state”:”California”,”abbreviation”:”CA”,”latitude”:36.116203,”longitude”:-119.681563,”small”:null},{“state”:”Colorado”,”abbreviation”:”CO”,”latitude”:39.059810,”longitude”:-105.311105,”small”:null},{“state”:”Connecticut”,”abbreviation”:”CT”,”latitude”:38.272689,”longitude”:-71.367188,”small”:true},….

Thank you in advance for any help…

  • 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-05-24T23:17:33+00:00Added an answer on May 24, 2026 at 11:17 pm

    You should be able to use the shorthand function, $.getJSON(), in this situation:

    var url = 'StateGeoPositions.aspx';
    
    $.getJSON(url, function(data){
        alert(data);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a heck of a time understanding C++/CLI syntax. I have a member
For some reason I am having a heck of a time getting my TabControl
I'm having a heck of a time figuring this out. I have a WCF
I have been having a heck of a time getting Udp sockets working correctly
example here: http://jsfiddle.net/R7GUZ/3/ I'm having a heck of a time getting list-style to work
For some reason I'm having a heck of a time figuring out how to
Im having a heck of a time. I have a datePicker setting start and
I am having one heck of a time with my implementation. We have a
I am having a heck of time with something that seems rather straightforward but
I'm having a heck of a time trying to get a gridview to refresh

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.