DEV Community

Discussion on: What is a best / simplest way to serialize / deserialize JavaScript objects?

Collapse
 
diek profile image
diek

The +new Date() returns the Date object parsed to number, so the same as (new Date()).getTime(). Y supose that it is easy to use, in his/her solution, the unix timestamp instead the string iso notation of the date. I don't know if you mean this.

I have a question to you too, why do you even will care about the keys being ordered?

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited
  • Both NeDB and MongoDB can differentiate between a real Date object, and date ISO string.
  • I mean, why special key ($$date), not Array. I cannot even make special Object work.
  • Keys being ordered is important when I try to hash Objects. In that case, I use fast-json-stable-stringify or js-yaml + SparkMD5.