a canonical json implementation
The goal of this module is to implement a version of JSON.stringify that returns a canonical JSON format.
Canonical JSON means that the same object should always be stringified to the exact same string.
Properties of non-array objects are not guaranteed to be stringified in any particular order. Do not rely on ordering of properties within the same object within the stringification.
This module implements two alternative solutions to this problem:
It currently exports the index.js version.
I compared the performance of native JSON.stringify and the two alternative implementations that output keys sorted:
The tests were run in Node.js on a 2011 MacBook Pro.
Performance test source: test/performance.js