Uhhh

JSON.stringify, what the HECK did you just do?

> c.values[0]
{ char: '10001',
pinyin: '',
english: [],
code: '00031',
cjkdecomp: [ 'ra', '㇑' ] }

> JSON.stringify(c.values[0])
'{"char":"10001","pinyin":"","english":"[\\n\\n]","code":"00031","cjkdecomp":"[\\n\\"ra\\",\\n\\"㇑\\"\\n]"}'

Did you just turn array-valued entities inside an object into string-valued entities....?

Is that... is that in the spec, somehow?

> c.values[20000]
{ char: '壜',
pinyin: 'tan2',
english: [ 'variant of 罈|坛[tan2]' ],
code: '058DC',
cjkdecomp: [ 'a', '土', '曇' ],
ids: [ '⿰土曇' ],
analysis: '⿰土曇',
kind: 's' }

>
JSON.stringify(c.values[20000])

'{"char":"壜","pinyin":"tan2","english":"[\\n\\"variant of 罈|坛[tan2]\\"\\n]","code":"058DC","cjkdecomp":"[\\n\\"a\\",\\n\\"土\\",\\n\\"曇\\"\\n]","ids":"[\\n\\"⿰土曇\\"\\n]","analysis":"⿰土曇","kind":"s"}'

How... how the heck am I supposed to parse that up again correctly....?

Surely any sane person asking 'convert this JSON to a string' would expect it to convert it to a string that resembles the actual JSON...?

But this seems to be recursing over objects and turning all subproperties, themselves, into strings.....?

Who ordered that?

Why is this the default 'to JSON' routine built into Node?

What's the rational explanation that I'm missing here?

Node 8.11.1, by the way. The current LTS. It's not an ancient one.

And yep, that output certainly does NOT JSON.parse() back as what went in.

> JSON.parse(x)
{ char: '壜',
pinyin: 'tan2',
english: '[\n"variant of 罈|坛[tan2]"\n]',
code: '058DC',
cjkdecomp: '[\n"a",\n"土",\n"曇"\n]',
ids: '[\n"⿰土曇"\n]',
analysis: '⿰土曇',
kind: 's' }
>

@natecull JSON.parse(JSON.stringify(x)) should give you a clone of x if it's a simple object like that