Closed theduke closed 8 months ago
When using JSON.stringify() on objects with keys that apparently don't support JSON serialization, the whole key is skipped.
JSON.stringify()
I would expect to at least still see a null key.
Or get an exception thrown.
Expected:
{ success: true, headers: ???, tail: 'tail' }
Actual:
{ success: true, tail: 'tail' }
async function handleRequest(request) { console.debug(request); const out = JSON.stringify({ success: true, headers: request.headers, tail: 'tail', }); return new Response(out, { headers: { "content-type": "application/json" }, }); } addEventListener("fetch", (req) => { req.respondWith(handleRequest(req)); });
Update: I believe this is happening because the value is undefined, and therefore skipped, so this may be expected?
The value was undefined, so this is expected...
When using
JSON.stringify()
on objects with keys that apparently don't support JSON serialization, the whole key is skipped.I would expect to at least still see a null key.
Or get an exception thrown.
Expected:
Actual: