From 8318e143de662816b0becdc2d26c2c5990a6397a Mon Sep 17 00:00:00 2001 From: Jonathan Putney Date: Mon, 23 Dec 2019 19:15:04 -0500 Subject: [PATCH] If root element is empty, don't start with dot --- src/BaseAPI.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BaseAPI.js b/src/BaseAPI.js index 4c44b9f..97c7fc3 100644 --- a/src/BaseAPI.js +++ b/src/BaseAPI.js @@ -810,9 +810,10 @@ export default class BaseAPI { this.startingData = json; + // could this be refactored down to flatten(json) then setCMIValue on each? for (const key in json) { if ({}.hasOwnProperty.call(json, key) && json[key]) { - const currentCMIElement = CMIElement + '.' + key; + const currentCMIElement = (CMIElement ? CMIElement + '.' : '') + key; const value = json[key]; if (value['childArray']) {