Added service components
[portal.git] / portal-FE-common / src / app / shared / services / utils / utils.service.ts
1 import { Injectable } from '@angular/core';
2
3 @Injectable({
4   providedIn: 'root'
5 })
6 export class UtilsService {
7
8   constructor() { }
9
10   isValidJSON(json) {
11     try {
12         var checkJSON = JSON.parse(JSON.stringify(json));
13         if (checkJSON && typeof checkJSON === 'object' && checkJSON !== null) {
14             // this.$log.debug('UtilsService::isValidJSON: JSON is valid!');
15             return true;
16         }
17     } catch (err) {
18         // this.$log.debug('UtilsService::isValidJSON: json passed is not valid: ' + JSON.stringify(err));
19     }
20     return false;
21 }
22 }