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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:55:41+00:00 2026-05-28T02:55:41+00:00

JavaScriptSerializer oSerializer = new JavaScriptSerializer(); object i = 3; string sJSON = oSerializer.Serialize(i); //3

  • 0
JavaScriptSerializer oSerializer = new JavaScriptSerializer();
object i = 3;
string sJSON =  oSerializer.Serialize(i); //"3"

The JavaScriptSerializer should serialize its parameter to JSON!

And the result is “3” ( which is not JSON)

What am I missing?

edit

Ive written a mail to douglas crockford

3 is not a json object/text but json value.

so i think msdn should clarify the serialize method.

https://i.stack.imgur.com/VOh3X.png

  • 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-28T02:55:41+00:00Added an answer on May 28, 2026 at 2:55 am

    As has been said many times by different people, the output you are receiving is valid JSON.

    From the JSON Specification (the Introduction):

    JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured types (objects and arrays).

    and further (Section 2.1):

    A JSON value MUST be an object, array, number, or string, or one of the following three literal names:

    false null true

    My interpretation of specification tells me that the case you describe here is more a JSON value than a JSON object.

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

Sidebar

Related Questions

I have the following C# helper class which retrieves a Json String from a
I want to serialize some objects into Json. Sometimes (not always, and I don't
I have an object model called MyObject that I'm serializing to a json string
Trying to convert a JSON string into an object in C#. Using a really
From Scottgu's post i got the code to Serialize a collection to JSON object.(i)How
I'd like to override the Serialize methods of the ASP.NET JavaScriptSerializer class. Nothing too
In one of my webservice methods I serialized my object calling JavaScriptSerializer.serilize in c#.
For some reason the following JSON string creates the correct number of records in
I have a js code in which an array works well when its like
I'm looking for way to convert dataSet with relations between its tables to JSON

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.