Use json validator if you wish to restrict the user input to a valid JSON.
<input type="text" ng:validate="json"/>
angular.validator.json(value)
value – {string} –
value to validate
<textarea name="json" cols="60" rows="5" ng:validate="json"> {name:'abc'} </textarea>
it('should invalidate json', function(){ var n1 = element('.doc-example-live :input'); expect(n1.prop('className')).not().toMatch(/ng-validation-error/); input('json').enter('{name}'); expect(n1.prop('className')).toMatch(/ng-validation-error/); });