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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:31:16+00:00 2026-06-14T12:31:16+00:00

I have a json array which I serialize , how do I access it

  • 0

I have a json array which I serialize, how do I access it in the javascript.
I am using javascript
amchartsand want to passvb.net` array to the javascript charts.
The code is provided below:

VB

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    DataSetToJSON()
End Sub
Public Function SelectChartData(ByVal Name As String) As DataSet
    Dim sqlCmd As New SqlCommand
    Dim myData As New DataSet

    sqlCmd.CommandTimeout = 1200

    sqlCmd.CommandType = CommandType.StoredProcedure
    sqlCmd.CommandText = "SelectAmChartdata"

    sqlCmd.Parameters.Add("@Name", SqlDbType.VarChar)
    sqlCmd.Parameters("@Name").Value = Name

    Dim da As New dsSV1TableAdapters.tblGeneralTableAdapter

    da.Adapter.SelectCommand = sqlCmd

    sqlCmd.Connection = da.Connection
    sqlCmd.Connection.Open()
    da.Adapter.Fill(myData)

    sqlCmd.Dispose()
    sqlCmd = Nothing

    da.Connection.Close()
    da.Connection.Dispose()
    da.Connection = Nothing

    Return myData

End Function

Public Function DataSetToJSON()
    Dim dt As DataTable
    ds = SelectChartData("Weather")


    Dim dict As New Dictionary(Of String, Object)

    For Each dt In ds.Tables
        Dim arr(dt.Rows.Count) As Object

        For i As Integer = 0 To dt.Rows.Count - 1
            arr(i) = dt.Rows(i).ItemArray
        Next

        dict.Add(dt.TableName, arr)
    Next

    Dim json As New JavaScriptSerializer
    Return json.Serialize(dict)

End Function

ASPX

<script type="text/javascript">

//var chartData =  **Access Serverside Array**

    window.onload = function () {
    var chart = new AmCharts.AmSerialChart();
    chart.dataProvider = chartData;
    chart.categoryField = "country";
    chart.marginTop = 15;
    chart.marginLeft = 55;
    chart.marginRight = 15;
    chart.marginBottom = 80;
    chart.angle = 30;
    chart.depth3D = 15;

    var catAxis = chart.categoryAxis;
    catAxis.gridCount = chartData.length;
    catAxis.labelRotation = 90;

    var graph = new AmCharts.AmGraph();
    graph.balloonText = "[[category]]: [[value]]";
    graph.valueField = "visits"
    graph.type = "column";
    graph.lineAlpha = 0;
    graph.fillAlphas = 0.8;
    chart.addGraph(graph);

    chart.write('chartContainer');
}
</script
  • 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-14T12:31:17+00:00Added an answer on June 14, 2026 at 12:31 pm

    You could dump the serialized data directly into an ASPX page:

    <script type="text/javascript">
    
        var my_data = <%= DataSetToJSON() %>;
    
    </script>
    

    Or you could use in the ASPX page:

    <input type="hidden" id="my_data" clientidmode="static" runat="server" value="" />
    

    And in the codebehind:

    my_data.Value = DataSetToJSON();
    

    You can then use document.getElementById('my_id').value to pull the data, decode it using something like JSON.parse and pass it in to your chart.

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

Sidebar

Related Questions

I have a complex json array which I want to target a specific line/string
I have created an empty json object having an array itemlist(which further contains itemid
I have a class which contains a list of items. I want to serialize
I have a name value pair array in Javascript (just like form.SerializeArray()) which i
I have a JSon array which is as follows: [{country:FR,id:2,latitude:-34.27175846153846,longitude:54.16125384615385,postcode:00000,region1:DOM-TOM,region2:Terres australes et antarctiques,region3:Crozet,region4:,version:null},{country:FR,id:3,latitude:46.203635000000006,longitude:5.20772,postcode:01000,region1:Rhône-Alpes,region2:Ain,region3:Bourg-en-Bresse,region4:Bourg-en-Bresse,version:null}, ...
I have used ajax in the code which works perfectly and give me json
I have a Json array which has the elements below: adjacencies, data, id, name.
I have a JSON array of data which is [ [[2, 5], [6, 10],
I have the following code, which works fine, that parses JSON. EVENT and SQUAD
Hi I have two uneven JSON array which I am decoding in php. First

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.