-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
20 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,18 +29,19 @@ | |
margin: 5px 10px 10px 0; | ||
} | ||
</style> | ||
<script src="https://unpkg.com/[email protected]/fmt2json.min.js"></script> | ||
</head> | ||
|
||
<body> | ||
<h2>format-to-json (v2.0.1)</h2> | ||
<h2>format-to-json (v2.1.1)</h2> | ||
<h4>Format a string to a json like template.</h4> | ||
<div class="status"> | ||
<textarea id="status" name="result" id="" cols="84" rows="8" disabled></textarea> | ||
</div> | ||
<div class="content"> | ||
<div> | ||
<label for="source">Format Source</label> | ||
<button onclick="fmt2json()">Format</button><br> | ||
<button onclick="formatToJson()">Format</button><br> | ||
<textarea id="source" name="source" id="" cols="40" rows="30"></textarea><br> | ||
</div> | ||
<div> | ||
|
@@ -49,17 +50,15 @@ <h4>Format a string to a json like template.</h4> | |
</div> | ||
</div> | ||
|
||
<script src="../fmt2json.min.js"></script> | ||
<script> | ||
const status = document.querySelector('#status'); | ||
const source = document.querySelector('#source'); | ||
const result = document.querySelector('#result'); | ||
source.value = '{"zjson":"ZJSON","description":"Online json formatter","version":"v4.1.8","updateTime":"2018-11-23","url":"http:https://zjson.net","project":"http:https://github.com/CN-Tower/zjson","language":["中文(简体)","English"],"keywords":["zjson","json formatter"],"content":{"array":["element 001","element 002"],"boolean":true,"null":null,"number":123,"string":"Hello World","object":{"property":"value","key":"val"}}}'; | ||
|
||
fmt2json(); | ||
|
||
async function fmt2json() { | ||
const fmtInfo = await formatToJson(source.value); | ||
formatToJson(); | ||
async function formatToJson() { | ||
const fmtInfo = await fmt2json(source.value); | ||
console.log(fmtInfo); | ||
result.value = fmtInfo.result; | ||
let fmtStatus = ''; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/** | ||
* @license | ||
* format-to-json v2.0.1 | ||
* format-to-json v2.1.1 | ||
* GitHub Repository <https://github.com/CN-Tower/format-to-json> | ||
* Released under MIT license <https://github.com/CN-Tower/format-to-json/blob/master/LICENSE> | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters