Re: [web-nfc] Check 'typedef any NDEFRecordData' to be a JSON type? (#307)

Domenic comments here makes sense

> In general specs that test “JSONness” of a value are just broken. Instead what you want to do is serialize the data to a string (or bytes) and then pass around the serialization as appropriate. I.e. there should be explicit serialization and deserialization steps, which talk about how to handle cases where serialization fails (because, for example, someone passed in the object { get x() { throw new Error(); } }).

We are testing `undefined` earlier but people could supply a non JSON type like a Symbol. So we just need to make sure that we handle serialization errors and then throw

-- 
GitHub Notification of comment by kenchris
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/307#issuecomment-525605154 using your GitHub account

Received on Wednesday, 28 August 2019 06:37:29 UTC