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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:27:54+00:00 2026-05-31T22:27:54+00:00

I need some help on the JavaScript. I do a ajax call on a

  • 0

I need some help on the JavaScript. I do a ajax call on a button click, which returns the below String and this is generated using GSON(basically it is a JSON object).

{ 
  "chart":{
      "renderTo":"container",
      "type":"bar"
   },
   "title":{
      "text":"Engagement Per Vendor Per GBP"
   },
   "subtitle":{
      "text":"ASPT"
   },
   "xAxis":{
      "categories":[
         "A",
         "B",
         "C",
         "D"
      ],
      "title":{
         "text":"Engagement Per Vendor Per GBP"
      }
   },
   "yAxis":{
      "min":0,
      "title":{
         "text":"Count",
         "align":"high"
      }
   },
   "plotOptions":{
      "bar":{
         "dataLabels":{
            "enabled":true
         }
      }
   },
   "legend":{
      "layout":"vertical",
      "align":"right",
      "verticalAlign":"bottom",
      "x":-100,
      "y":100,
      "floating":true,
      "borderWidth":1,
      "backgroundColor":"#FFFFFF",
      "shadow":true
   },
   "credits":{
      "enabled":true
   },
   "series":[
      {
         "name":"ABC",
         "data":[
            10,
            20,
            20,
            30
         ]
      },
      {
         "name":"DEF",
         "data":[
            10,
            20,
            30,
            40
         ]
      },
      {
         "name":"GHIJ",
         "data":[
            20,
            30,
            40,
            10
         ]
      },
      {
         "name":"KLMN",
         "data":[
            10,
            40,
            20,
            30
         ]
      }
   ]
}

When I get this data in my javascript.
I’m trying to convert the object to JSON using the below statement

var jsonObj = eval(xmlHttp.responseText);

xmlHttp.responseText has the below string

{"chart":{"renderTo":"container","type":"bar"},"title":{"text":"Engagement Per Vendor Per GBP"},"subtitle":{"text":"ASPT"},"xAxis":{"categories":["A","B","C","D"],"title":{"text":"Engagement Per Vendor Per GBP"}},"yAxis":{"min":0,"title":{"text":"Count","align":"high"}},"plotOptions":{"bar":{"dataLabels":{"enabled":true}}},"legend":{"layout":"vertical","align":"right","verticalAlign":"bottom","x":-100,"y":100,"floating":true,"borderWidth":1,"backgroundColor":"#FFFFFF","shadow":true},"credits":{"enabled":true},"series":[{"name":"ABC","data":[10,20,20,30]},{"name":"DEF","data":[10,20,30,40]},{"name":"GHIJ","data":[20,30,40,10]},{"name":"KLMN","data":[10,40,20,30]}]}

When I try to run the jsp, it stops at var jsonObj = eval(xmlHttp.responseText);

I have done this before many time, but this time the data is different. The JSON string was created by by a JSON method from GSON api.

Unless I get this in to a JSON object, I’ll not be able to do anything with it. Any help on this is appreaciated.

Regards,
Senny

  • 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-31T22:27:56+00:00Added an answer on May 31, 2026 at 10:27 pm

    jQuery can do it:

    http://api.jquery.com/jQuery.parseJSON/

    If you don’t want to use eval, here is a standalone parser: https://github.com/douglascrockford/JSON-js

    UPDATE Just use the in-built JSON object

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

Sidebar

Related Questions

Hey. I need some help with jQuery Ajax calls. In javascript I have to
Need some help from javascript gurus. I have one page where http://www.google.com/finance/converter is embedded
Need some help to solve this. I have a gridview and inside the gridview
Need some help with this problem in implementing with XSLT, I had already implemented
Need some help gathering thoughts on this issue. Our team is moving ahead with
I've got form which when submitted (using AJAX) returns a bunch of client details.
I need help with adding to a database. I want to call a javascript
We need some input on what is a good design pattern on using AJAX
I'm having some trouble with an Ajax script which disables my jQuery click events.
I am trying to log JavaScript events such as AJAX and click events using

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.