diff --git a/Modern Development/Service Portal Widgets/JSON Beautifier/Client_side.js b/Modern Development/Service Portal Widgets/JSON Beautifier/Client_side.js new file mode 100644 index 0000000000..8def55ccb7 --- /dev/null +++ b/Modern Development/Service Portal Widgets/JSON Beautifier/Client_side.js @@ -0,0 +1,18 @@ +api.controller=function($scope) { + /* widget controller */ +$scope.rawJson = ''; +$scope.formattedJson = ''; +$scope.error = ''; + + $scope.beautifyJSON = function(){ + try{ + $scope.error = ''; + const parsed = JSON.parse($scope.rawJson); + $scope.formattedJson = JSON.stringify(parsed,null,2); + }catch(e){ + $scope.error = 'Invalid JSON' + e.message; + $scope.formattedJson = ''; + } + }; + +}; diff --git a/Modern Development/Service Portal Widgets/JSON Beautifier/HTML.html b/Modern Development/Service Portal Widgets/JSON Beautifier/HTML.html new file mode 100644 index 0000000000..7993db5057 --- /dev/null +++ b/Modern Development/Service Portal Widgets/JSON Beautifier/HTML.html @@ -0,0 +1,21 @@ +
+

JSON Beautifier

+
+ + +
+
+ +
+
+
+ {{error}} +
+
+
+ +
{{formattedJson}}
+
+
diff --git a/Modern Development/Service Portal Widgets/JSON Beautifier/README.md b/Modern Development/Service Portal Widgets/JSON Beautifier/README.md new file mode 100644 index 0000000000..ee2ab4df5e --- /dev/null +++ b/Modern Development/Service Portal Widgets/JSON Beautifier/README.md @@ -0,0 +1,11 @@ +## JSON Beautifier Widget + +The JSON Beautifier widget is a developer-focused tool designed to make working with JSON in ServiceNow fast, easy and efficient. It helps admins, developers and testers handles JSON payloads from APIs, Integration etc. + +## Benefits +- Reduces time spent manually formatting or checking JSON. +- Helps identify error or differences between JSOn payload quickly + +## Output +![A test image](demo.png) + diff --git a/Modern Development/Service Portal Widgets/JSON Beautifier/demo.png b/Modern Development/Service Portal Widgets/JSON Beautifier/demo.png new file mode 100644 index 0000000000..e8a4ab4ef7 Binary files /dev/null and b/Modern Development/Service Portal Widgets/JSON Beautifier/demo.png differ