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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:19:21+00:00 2026-06-15T03:19:21+00:00

I’m creating a webpage to create graphs and charts on the fly with High

  • 0

I’m creating a webpage to create graphs and charts on the fly with High Charts using ajax, vb and .net. I currently can call my webservice which runs and returns json however I can’t get the correct json. The function I’m using to return json can serialize it fine for one object but the way I have it setup makes more than one incorrect.

<OperationContract()>
<WebMethod()>
Public Function DoWork() As String
    ' Add your operation implementation here

    Dim prod As New product

    Dim strConnString As String = ConfigurationManager.ConnectionStrings("STEMConnectionString").ConnectionString
    Dim myConnection As SqlConnection

    myConnection = New SqlConnection(strConnString)

    myConnection.Open()

    Dim strData As String = "SELECT Student_Survey_Response_Fact.StudentID,  Student_Survey_Response_Fact.SurveyID, " & _
    "Survey_ItemR.SurveyQuestionText, Student_Survey_Response_Fact.ResponseText, Survey_ItemR.SurveyResponseNo, Student_Lite.Gender " & _
    "FROM Student_Survey_Response_Fact INNER JOIN " & _
    "Survey_ItemR ON Student_Survey_Response_Fact.ResponseNo = Survey_ItemR.SurveyResponseNo INNER JOIN " & _
    "Student_Lite ON Student_Survey_Response_Fact.StudentID = Student_Lite.StudentId INNER JOIN " & _
    "Survey_Item ON Student_Lite.SchoolYear = Survey_Item.SchoolYear " & _
    "WHERE (Student_Survey_Response_Fact.ResponseText <> 'NULL')"

    Dim Command As New SqlCommand(strData, myConnection)

    Dim reader As SqlDataReader

    reader = Command.ExecuteReader

    Dim stream As New MemoryStream

    Dim jsonSerializer As New DataContractJsonSerializer(GetType(product))

    While reader.Read
        prod.stuID = reader("StudentID").ToString
        prod.gender = reader("Gender").ToString
        prod.surveyID = reader("SurveyID").ToString
        prod.surveyQ = reader("SurveyQuestionText").ToString
        prod.surveyR = reader("ResponseText").ToString
        prod.surveyNum = reader("SurveyResponseNo").ToString
        jsonSerializer.WriteObject(stream, prod)
    End While

    stream.Position = 0

    Dim streamRead As New StreamReader(stream)

    Return streamRead.ReadToEnd()

I know why it does it but I’m not sure how to fix it. I put the jsonSerializer.WriteObject(stream, prod) in the loop so it creates a json string per object. The problem is the output looks like this on the client side:

d:{"gender":"M","stuID":"005716305","surveyA":null,"surveyID":"201202","surveyNum":"Resp 09","surveyQ":"Please indicate how you feel about the following statement: - I would like to enter a science competition or science fair in the future.","surveyR":"Disagree"}{"gender":"M","stuID":"005716305","surveyA":null,"surveyID":"201202","surveyNum":"Resp 10","surveyQ":"Please indicate how you feel about the following statement: - The science in school is not related to my everyday life.","surveyR":"Agree"}{"gender":"F","stuID":"005716310","surveyA":null,"surveyID":"201202","surveyNum":"Resp 03","surveyQ":"Which subjects do you most like to study in school? Rank them from like it a lot to don't like it at all. - Science","surveyR":"like it a lot"}{"gender":"F","stuID":"005716310","surveyA":null,"surveyID":"201202","surveyNum":"Resp 06","surveyQ":"Please indicate how you feel about the following statement: - I would rather find out why something happens by doing an experiment than being told.","surveyR":"Agree"}

Which does not have the correct json syntax.

My client side ajax call looks like this:

success: function (result) {
    $.parseJSON(result);
    $.each(result, function (key, value) {
        $('body').append(key + ': ' + value);
    });
}

I’m not sure if I’m calling it right but I know the webService isn’t correct.

  • 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-15T03:19:22+00:00Added an answer on June 15, 2026 at 3:19 am

    Here’s a link to the answer. I pretty much followed the example straight through it was the lack of an List to hold the object.

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

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I am currently running into a problem where an element is coming back from
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.