Adds test for JSON.stringification of trimmed arrays. Closes #246
Adds support for .toJSON in the stringifier.
travisplexer: pr-507-linux travis ci test