substack/json-stable-stringify — pull request #6 by kapetan (2014-05-27 10:25:53+00:00)
Title: Enable toJSON function to return different types

Call `toJSON` first, if it returns a value other than object, it is properly serialized.