From 8e48a3a52318709cd57599c6a030691de7f71c6a Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Wed, 20 Mar 2019 13:51:10 -0400 Subject: [PATCH] interpret empty codemirror json content as empty object --- awx/ui/client/src/shared/parse/parse-type-change.factory.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/awx/ui/client/src/shared/parse/parse-type-change.factory.js b/awx/ui/client/src/shared/parse/parse-type-change.factory.js index 218dfbbe9a..2373a06a46 100644 --- a/awx/ui/client/src/shared/parse/parse-type-change.factory.js +++ b/awx/ui/client/src/shared/parse/parse-type-change.factory.js @@ -94,8 +94,12 @@ export default // convert json to yaml try { removeField(fld); + let jsonString = scope[fld]; + if (jsonString.trim() === '') { + jsonString = '{}'; + } - json_obj = JSON.parse(scope[fld]); + json_obj = JSON.parse(jsonString); if ($.isEmptyObject(json_obj)) { scope[fld] = '---'; }