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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:43:26+00:00 2026-06-14T17:43:26+00:00

Every JSON serialization utility or library I’ve used is seems to be broken, and

  • 0

Every JSON serialization utility or library I’ve used is seems to be broken, and I cannot get the logical explanation on this.

Let me explain. I run following code in Firebug for JSON libraries for .NET, probably for other languages.

I just check in Firefox, when I run:

var obj1 = "test";
var obj1serialization = JSON.stringify(obj1);

The output is ""test"". But this is invalid JSON object! So when I tried to re-create object from that serialized JSON, it failed, stating that JSON string is incorrect:

var obj2 = JSON.parse(obj1serialization);

Strings are objects. But their serialization in JSON not working. Is there any logical explanation of this situation?

  • 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-14T17:43:28+00:00Added an answer on June 14, 2026 at 5:43 pm

    In JSON (unlike several programming languages), strings are not objects, they’re primitives (like numbers and booleans). You’re asking the serializer to create a JSON fragment. A valid JSON document’s top-level item is always an object or an array. If you feed one of those into JSON.stringify, it will produce a valid, complete JSON document.

    The fact that most JSON serializers allow fragments is quite useful. The only alternative they’d have would be to throw an exception if you passed something into them that wasn’t an object or array.

    JSON.parse is more restrictive, requiring that the JSON document you give it be both complete and well-formed. Not all JSON parsing routines are that restrictive, but that one is.

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

Sidebar

Related Questions

Does this vim regex match only correct JSON strings? Does it match every correct
Every time i try to work with sencha touch to get a json feed
I am studying javascript and json but every line of code I write is
Every example I find of anyone implementing plugins in android seems to use aexp.intent.action.
Hi every one when returning json data from webservice top tag is adding please
I'm having trouble using the System.Runtime.Serialization.Json.DataContractJsonSerializer class to deserialize DateTime instances contained within a
My jqGrid gets its JSON data from a URL. It shows every columnt right
I got a valid Json string(at least every onlinevalidator I tried says so) which
Is it possible to replace the default JSON serialization of WCF (I'm currently testing
I have some code that looks like this: NSDictionary* json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions

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.