-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformatJson.html
94 lines (94 loc) · 4.12 KB
/
formatJson.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en" class="d-flex h-100">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JSON Formatter</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>⚙️</text></svg>">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link href="theme.css" rel="stylesheet" />
<script type="module" src="darkModeSupport.js" defer></script>
<script type="module" src="formatJson.js" defer></script>
</head>
<body class="flex-fill d-flex">
<div class="flex-fill container d-flex flex-column p-3">
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="index.html">Web shorts</a></li>
<li class="breadcrumb-item active" aria-current="page">
JSON Formatter
</li>
</ol>
</nav>
<p class="mb-3">
The text area below will accept any JSON string then let you format it with the form below.
</p>
<form id="config" class="mb-3 row">
<div class="col">
<label class="pb-2">Format</label>
<div class="btn-group d-block">
<input id="format-pretty" class="btn-check" checked type="radio" name="format" value="pretty" autocomplete="off">
<label for="format-pretty" class="btn btn-outline-primary">
Pretty
</label><!--
--><input id="format-flat" class="btn-check" type="radio" name="format" value="flat" autocomplete="off"><!--
--><label for="format-flat" class="btn btn-outline-primary">
Flat
</label>
</div>
</div>
<div class="col">
<label class="pb-2">MIME Type</label>
<div class="btn-group d-block">
<input id="mime-json" class="btn-check" checked type="radio" name="type" value="json" autocomplete="off">
<label for="mime-json" class="btn btn-outline-primary">
JSON
</label><!--
--><input id="mime-yaml" class="btn-check" type="radio" name="type" value="yaml" autocomplete="off"><!--
--><label for="mime-yaml" class="btn btn-outline-primary">
YAML
</label>
</div>
</div>
<div class="col">
<label id="indentationLabel" for="indentation" class="pb-2">Indentation</label>
<input id="indentation"
name="indentation"
type="number"
class="form-control"
placeholder="Indentation"
aria-labelledby="indentationLabel"
aria-describedby="indentationHelpBlock"
value="2"/>
<small id="indentationHelpBlock" class="form-text text-muted">
Change the indentation when pretty printing your JSON.
</small>
</div>
</form>
<form id="editorForm" class="flex-grow-1 d-flex flex-column">
<div class="flex-grow-1 d-flex flex-column">
<label id="editorLabel" for="editor" class="pb-2">Editor</label>
<textarea id="editor"
name="editor"
class="form-control flex-grow-1"
style="font-family: SFMono-Regular,Menlo,Monaco,Consolas,'Liberation Mono','Courier New',monospace; overflow-y: auto"
placeholder="Place your JSON here"
aria-labelledby="editorLabel"
aria-describedby="editorHelpBlock"></textarea>
<small id="editorHelpBlock" class="form-text text-muted">
Paste your JSON here for pretty printing.
</small>
</div>
<div class="d-flex align-items-start mt-2">
<span id="validation" class="badge">Getting prepared</span>
<button class="ms-auto btn btn-secondary btn-icon-start" id="reorder" type="button">
Reorder properties
</button>
<button class="ms-2 btn btn-primary btn-icon-start" type="submit">
Copy
</button>
</div>
</form>
</div>
</body>
</html>