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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:27:03+00:00 2026-05-22T23:27:03+00:00

I am trying to return a json string via jQuery of an object using

  • 0

I am trying to return a json string via jQuery of an object using the following function. The problem I do not seem to be able to overcome is my json result comes out the other end wrapped in double quotes.

I have seen in this post that I should;

have your method return an actual object and let the JSON serialization of the framework do the heavy lifting for you

But I don’t fully understand that this means.

This is the function I am using.

Public Function getLine() As String

    Dim data As List(Of ArrayList) = New List(Of ArrayList)

    For Each q In getAllData()
        Dim a As New ArrayList
        Dim d As Date = q.DateTime
        a.Add(d.Ticks)
        a.Add(q.TotalRevenue)
        data.Add(a)
    Next

    Dim s As New Serie
    s.data = data
    Dim str As String = JsonConvert.SerializeObject(s)
    Return str

End Function

Any ideas greatly appreciated.

$.ajax({
    type: "POST",
    dataType: "json",
    data: "{}",
    contentType: "application/json; charset=utf-8",
    url: "_services/ScriptService.asmx/getData",
    success: function (items) {
        var data = eval("(" + items.d + ")");
    },
    cache: false,
    error: function (XMLHttpRequest, textStatus, errorThrown) { alert(errorThrown); }
});

‘items.d’ contains…

"{"data":[[634420512000000000,100000.0000] ... [634421376000000000,100086.0000]]}"

if i eval ‘items.d’ i get…

[[634420512000000000, 100000] ... [634421376000000000, 100086]

I read somewhere that eval is evil, is this true?

  • 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-22T23:27:04+00:00Added an answer on May 22, 2026 at 11:27 pm

    Not clear whether you’re having problem with the code you posted or with the javascript that handles it. So you’re getting a result, it’s just wrapped in double quotes? If you put a breakpoint at the beginning of the javascript callback function in Visual Studio, you should be able to see what is being returned. Just call eval on that string, and extract out whatever you need from the object. From that other article you quoted:

    You obviously just want to get at the
    object. You have 2 options: –

    1) use eval in your javascript to turn
    the string into an object e.g.

    function onSuccessCallback(retval) {
    var obj = eval(retval.d); } //put the breakpoint here and use the immediate or watch window to see what the value for retval.d is. Post it to your question so we can see what you’re getting.

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

Sidebar

Related Questions

I am trying to return a JSON object from an aspx page using Jayrock.JSON.
I'm trying to get the JSON format string from my custom object by using
I'm trying to return a JSON response from a Django view call via an
Trying to create a list to return some JSON data to a view. Following
Using Spring 3.0.5, I am trying to return a list of strings in JSON
While trying to pass part of a Json string to a function I get
I'm trying to return a JSON string from an AJAX call to my database
I'm trying to return a json result from a jQuery Form instance - but
I'm trying to create this JSON string but having problem creating it. I'm getting
I'm trying to return an error message via Json from ASP.NET MVC controller. 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.