Using JSON.stringify in conjunction with TypeScript getter/setter : <p>I am using getter/setter accessors in TypeScript. As it is not possible to have the same name for a variable and method, I started to prefix the variable with a lower dash, as is done in many examples:</p>

<pre><code>private _major: number;

get major(): number {
  return this._major;
}
set major(major: number) {
  this._major = major;
}
</code></pre>

<p>Now when I use the JSON.stringify() method to convert the object into a JSON string, it will use the variable name as the key: _major.</p>

<p>As I don't want the JSON file to have all keys prefixed with a lower dash, is there any possibility to make TypeScript use the name of the getter method, if available? Or are there any other ways to use the getter/setter methods but still produce a clean JSON output?</p>

<p>I know that there are ways to manually modify the JSON keys before they are written to the string output. I am curious if there is simpler solution though.</p>

<p><a href="https://jsfiddle.net/7d7tndhh/1/" rel="noreferrer">Here is a JSFiddle</a> which demonstrates the current behaviour.</p>
