-export function formatJsonString(jsonToFormat: any): string {
- return JSON.stringify(jsonToFormat, null, 2);
-}
+ jsonValidator(): ValidatorFn {
+ return (control: AbstractControl): { [key: string]: any } | null => {
+ const notValid = !this.isJsonValid(control.value);
+ this.handleJsonChangeEvent(notValid, control.value);
+ return notValid ? { 'invalidJson': { value: control.value } } : null;
+ };
+ }