mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
Tidied JSON Beautify op. Changed default indent to 4 spaces instead of a tab.
This commit is contained in:
parent
8c5d05b611
commit
6f4ee8b7b6
3 changed files with 5 additions and 5 deletions
|
@ -28,7 +28,7 @@ class JSONBeautify extends Operation {
|
||||||
{
|
{
|
||||||
"name": "Indent string",
|
"name": "Indent string",
|
||||||
"type": "binaryShortString",
|
"type": "binaryShortString",
|
||||||
"value": "\\t"
|
"value": " "
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Sort Object Keys",
|
"name": "Sort Object Keys",
|
||||||
|
@ -44,8 +44,8 @@ class JSONBeautify extends Operation {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
const indentStr = args[0];
|
const [indentStr, sortBool] = args;
|
||||||
const sortBool = args[1];
|
|
||||||
if (!input) return "";
|
if (!input) return "";
|
||||||
if (sortBool) {
|
if (sortBool) {
|
||||||
input = JSON.stringify(JSONBeautify._sort(JSON.parse(input)));
|
input = JSON.stringify(JSONBeautify._sort(JSON.parse(input)));
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* @author Phillip Nordwall [Phillip.Nordwall@gmail.com]
|
* @author Phillip Nordwall [Phillip.Nordwall@gmail.com]
|
||||||
*
|
*
|
||||||
* @copyright Crown Copyright 2017
|
* @copyright Crown Copyright 2018
|
||||||
* @license Apache-2.0
|
* @license Apache-2.0
|
||||||
*/
|
*/
|
||||||
import TestRegister from "../../TestRegister";
|
import TestRegister from "../../TestRegister";
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* @author Phillip Nordwall [Phillip.Nordwall@gmail.com]
|
* @author Phillip Nordwall [Phillip.Nordwall@gmail.com]
|
||||||
*
|
*
|
||||||
* @copyright Crown Copyright 2017
|
* @copyright Crown Copyright 2018
|
||||||
* @license Apache-2.0
|
* @license Apache-2.0
|
||||||
*/
|
*/
|
||||||
import TestRegister from "../../TestRegister";
|
import TestRegister from "../../TestRegister";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue