refactor(angular.toJson): use charAt instead of regexp

Provides a performance improvement when serializing to JSON strings.

Closes #4093