use native JSON.stringify for escaping, add tests and browserify infrastructure