Skip to content

Commit 764acd1

Browse files
committed
Exclude ',' from syntax coloring in JSON structure
1 parent 787232a commit 764acd1

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/Pages/Home/JwtDecoder/JwtDecoder.cshtml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page "~/jwt-decoder"
1+
@page "~/jwt-decoder"
22
@model IdentityServerHost.Pages.Home.JwtDecoder
33

44
<div class="jwt-decoder-page">
@@ -478,21 +478,33 @@
478478
});
479479
contents.append(`<span class="json-object-end">}${(isLastItem ? '' : ',')}</span>`);
480480
} else if (typeof value === 'string') {
481-
const text = JSON.stringify(value) + (isLastItem ? '' : ',');
481+
const text = JSON.stringify(value);
482482
contents.text(text);
483483
contents.addClass('json-string');
484+
if (!isLastItem) {
485+
contents.append('<span class="json-structure">,</span>');
486+
}
484487
} else if (typeof value === 'number') {
485-
const text = value + (isLastItem ? '' : ',');
488+
const text = value;
486489
contents.text(text);
487490
contents.addClass('json-number');
491+
if (!isLastItem) {
492+
contents.append('<span class="json-structure">,</span>');
493+
}
488494
} else if (typeof value === 'boolean') {
489-
const text = (value ? 'true' : 'false') + (isLastItem ? '' : ',');
495+
const text = value ? 'true' : 'false';
490496
contents.text(text);
491497
contents.addClass('json-boolean');
498+
if (!isLastItem) {
499+
contents.append('<span class="json-structure">,</span>');
500+
}
492501
} else {
493-
const text = String(value) + (isLastItem ? '' : ',');
502+
const text = String(value);
494503
contents.text(text);
495504
contents.addClass('json-unknown');
505+
if (!isLastItem) {
506+
contents.append('<span class="json-structure">,</span>');
507+
}
496508
}
497509
498510
if (options.explainClaims && key && explain) {

0 commit comments

Comments
 (0)