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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:56:46+00:00 2026-06-03T02:56:46+00:00

Tested using chrome Canary I can convert a date to JSON: > (new Date()).toJSON()

  • 0

Tested using chrome Canary

I can convert a date to JSON:

> (new Date()).toJSON()
  "2012-05-03T22:27:30.530Z"

I can convert it back to a Date:

> typeof (new Date("2012-05-03T22:27:30.530Z"))
  object

Why can’t I parse it as a Date using JSON.parse()? JSON.parse returns a string, not a Date:

> JSON.parse('{"DateValue":"2012-05-03T22:27:30.530Z"}').DateValue
 "2012-05-03T22:27:30.530Z"
  • 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-03T02:56:48+00:00Added an answer on June 3, 2026 at 2:56 am

    Because a Date is not a valid type in JSON. JSON only knows about strings, numbers, booleans, arrays, and generic objects (associative arrays/hashes/maps/dictionaries/pick-your-favorite-name). When you convert anything else to JSON, you get one of the above – which means if you want to get the “something else” back out as the type it started as, the receiver has to do some extra work to recreate it.

    There are JSON libraries that abstract that work away, and include an extra attribute indicating what class something is, so if the receiver is using the same library they’ll get that type back, but that’s still the same work, just hidden by the library.

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

Sidebar

Related Questions

Update: I just tested my JSON format returned from the server using JSONlint and
[All of the following was tested using Visual Studio 2008 SP1] In C++, const
Using jQuery's dialog I came across the following quirk (tested in FF3): User selects
How to inject method (using reflection) into super class without extending tested class? I
I have tested the below script on a demo page which is not using
I'm using simplemodal to popup a modal window. I've tested the modal window functionality
I build PHP for android using the NDK. Most functions tested so far run
I need to verify a password using reqex. I have written one and tested
While using this code, i can't get any results... Ext.define('Teste.view.Main', { extend: 'Ext.Container', initialize:
I have a problem using $.getScript() on chrome. It doesn't work on chrome browser.

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.