Re: [web-nfc] What's the value of `toJSON()`? (#366)

I'm not sure why having `NDEFRecord.json()` will prevent or even empower web developers to use `JSON.stringify`. They already have 3 ways to push JSON objects today. Unless we provide helpful documentation on why this is bad practise (encoding added, bigger size), I think people are going to use the easy way, regardless of the `json()` method

```js
// #1
writer.push(JSON.stringify({ key1: "value1" }));

// #2
writer.push({
  records: [
    {
      recordType: "text",
      data: JSON.stringify({ key1: "value1" })
    }
  ]
});

// #3
writer.push({
  records: [
    {
      recordType: "json",
      mediaType: "application/json",
      data: { key1: "value1" }
    }
  ]
});
```

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

Received on Friday, 11 October 2019 14:54:04 UTC