Skip to content

Commit 2230d7e

Browse files
Alamantusrobbie-inquisicorp
authored andcommitted
Apply PR from JimZeeKing:
tcorral#14
1 parent ebccb64 commit 2230d7e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/JSONC.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202

203203
for (nIndex = 0; nIndex < nLenKeys; nIndex++) {
204204
aKey = aKeys[nIndex];
205-
str = str.replace(new RegExp(escapeRegExp('"' + aKey[1] + '"'), 'g'), '"' + aKey[0] + '"');
205+
str = str.replace(new RegExp('(?:"' + escapeRegExp(aKey[1]) + '"):', 'g'), '"' + aKey[0] + '":');
206206
}
207207
obj = JSON.parse(str);
208208
obj._ = oKeys;
@@ -236,7 +236,7 @@
236236
str = JSON.stringify(jsonCopy);
237237
for (sKey in oKeys) {
238238
if (oKeys.hasOwnProperty(sKey)) {
239-
str = str.replace(new RegExp('"' + sKey + '"', 'g'), '"' + oKeys[sKey] + '"');
239+
str = str.replace(new RegExp('(?:"' + sKey + '"):', 'g'), '"' + oKeys[sKey] + '":');
240240
}
241241
}
242242
return str;

0 commit comments

Comments
 (0)