A simple JSON stringify function which requires Array.prototype.map method.
The following users provided lots of ideas and improvements of the code.
@Kambfhase, @hartrock, @atk, @haochi, @jed
Actually, I just provided a deficient version at first. The other versions were created by these users(especially @atk). You may see the discussion below.
In http://www.json.org/ it's not totally clear, but in http://www.ietf.org/rfc/rfc4627.txt?number=4627 there is stated:
+++
2. JSON Grammar
A JSON text is a sequence of tokens. The set of tokens includes six
structural characters, strings, numbers, and three literal names.
A JSON text is a serialized object or array.
These are the six structural characters:
+++
So there is no need for "null", which Firefox's JSON.stringify(null) reveals.
But there remains a need for "{}": 6 bytes left for that...