From 4ac6f1d813fd3d58ab8443e21b5d6fdf7ef3679a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chao=20Wang=20=EF=BC=88=E7=8E=8B=E8=B6=85=EF=BC=89?= Date: Fri, 8 May 2020 16:24:07 +0800 Subject: [PATCH] sort json file by keys --- main/plugins/json/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/json/index.ts b/main/plugins/json/index.ts index d18ed4c8..e5cf6598 100644 --- a/main/plugins/json/index.ts +++ b/main/plugins/json/index.ts @@ -10,7 +10,7 @@ export const parse = (content: string): Promise => { export const serialize = async (data: object): Promise => { try { - return JSON.stringify(data, null, 2); + return JSON.stringify(data, Object.keys(data).sort(), 2); } catch (e) { return undefined; }