Pretty print JSON

Developer
Size
1,833 Kb
Views
10,120

How do I make an pretty print json?

What is a pretty print json? How do you make a pretty print json? This script and codes were developed by Sheodox on 26 December 2022, Monday.

Pretty print JSON Previews

Pretty print JSON - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pretty print JSON</title>
</head>
<body> <div ng-app='ObjectPrinter' ng-controller='ObjectPrintController as opCtrl'> <label>Paste json in the box:	<input ng-model='opCtrl.string' placeholder='paste json here'/> </label> <br> <pre>{{opCtrl.startPrint(opCtrl.string)}}</pre>
</div> <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Pretty print JSON - Script Codes JS Codes

(function(){ var app = angular.module('ObjectPrinter', []); app.controller('ObjectPrintController', function(){ this.string = '{"mind": "blown", "angular":{"iscool": "true"}}'; this.startPrint = function(value) {	return this.ObjectPrint(JSON.parse(value)); } this.ObjectPrint = function(obj, depth) { depth = depth || 0; var printObj = this.padSpaces(depth) + '{\n'; for (var item in obj) { if (typeof obj[item] === 'object') printObj += this.padSpaces(depth) + item + ': ' + this.ObjectPrint(obj[item], depth + 1) + '\n'; else printObj += this.padSpaces(depth) + item + ': ' + obj[item] + '\n'; } printObj += this.padSpaces(depth) + '} '; return printObj; } this.padSpaces = function(numSpaces) { var spaces = ''; for (var i = 0; i < numSpaces; i++) spaces += ' '; return spaces; } });
})();
Pretty print JSON - Script Codes
Pretty print JSON - Script Codes
Home Page Home
Developer Sheodox
Username sheodox
Uploaded December 26, 2022
Rating 3
Size 1,833 Kb
Views 10,120
Do you need developer help for Pretty print JSON?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Sheodox (sheodox) Script Codes
Create amazing video scripts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!