---
title: "Comment by SMTasker on \"TypeScript private vs Native JS Private Fields (#)\" | Hashnode"
description: "One useful addition to the JSON.stringify example is a custom toJSON method. That method runs inside the class and can deliberately return a #field, so private"
url: "https://hashnode.com/posts/typescript-private-vs-native-private-fields/6ae74033f9684b74a6d6909c/comment/6ae9d137aa3f6b190da45355"
---

[Discussion](https://hashnode.com/posts/typescript-private-vs-native-private-fields/6ae74033f9684b74a6d6909c)

Comment [TypeScript private vs Native JS Private Fields (#)](https://hashnode.com/posts/typescript-private-vs-native-private-fields/6ae74033f9684b74a6d6909c)

[SMTasker](https://hashnode.com/@smtasker)

[Nov 3](https://hashnode.com/posts/typescript-private-vs-native-private-fields/6ae74033f9684b74a6d6909c/comment/6ae9d137aa3f6b190da45355)

One useful addition to the JSON.stringify example is a custom toJSON method. That method runs inside the class and can deliberately return a #field, so private fields do not guarantee that an instance's serialized output contains no secrets. An explicit public-data projection is still a separate decision.
