Worth noting here that although this is called `toJSON`, it returns a stringify-able JS object as per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON_behavior