We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dcae38b commit 85f3eb1Copy full SHA for 85f3eb1
src/lib/JsonView.svelte
@@ -27,7 +27,7 @@ function getType(i) {
27
*/
28
function format(i) {
29
const t = getType(i)
30
- if (t === 'string') return `"${i}"`
+ if (t === 'string') return `${JSON.stringify(i)}`
31
if (t === 'function') return 'f () {...}'
32
if (t === 'symbol') return i.toString()
33
return i
@@ -79,7 +79,7 @@ $: collapsed = depth < _cur
79
{#each items as i, idx}
80
<li>
81
{#if !isArray}
82
- <span class="_jsonKey">"{i}"</span><span class="_jsonSep">:</span>
+ <span class="_jsonKey">{JSON.stringify(i)}</span><span class="_jsonSep">:</span>
83
{/if}
84
{#if getType(json[i]) === 'object'}
85
<svelte:self json={json[i]} {depth} _cur={_cur + 1} _last={idx === items.length - 1} />
0 commit comments