Pretty print JSON
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 - 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; } });
})();
Developer | Sheodox |
Username | sheodox |
Uploaded | December 26, 2022 |
Rating | 3 |
Size | 1,833 Kb |
Views | 10,120 |
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!
Name | Size |
Youtube video time counter. | 1,797 Kb |
Pure Libs | 2,656 Kb |
Clean Expanding Tab Hover Navigation | 2,473 Kb |
Jisho Lookup Bookmarklet | 1,801 Kb |
Text Highlighter | 2,562 Kb |
Format time function | 1,546 Kb |
Angular todo list test | 1,664 Kb |
WIP pulsing loading bar | 1,881 Kb |
Windows-like Loading Bar | 2,110 Kb |
Cool squares. | 1,894 Kb |
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!
Name | Username | Size |
Basic 3D Fullscreen Transition | Apetrov | 3,270 Kb |
Simple Flat Menu | Jeplaa | 2,467 Kb |
Table border-collapse property | Maxds | 1,672 Kb |
Ocean | Gordonnl | 2,817 Kb |
Direction-icon | Alexandremasy | 3,323 Kb |
Random Gradients - JS | Aldlevine | 2,026 Kb |
Hamburger Menu Animation | Salmanraza | 2,580 Kb |
A vuejs widget | Chrgl86 | 2,869 Kb |
Em Test | Rodesco | 1,784 Kb |
A bit of elegance | Hackthevoid | 9,095 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!