title: JSON Compatible Output of Whole Object and Their Invisible Properties in Node
body: <pre><code>const TelegramBot= require('./telegram-bot') // It's currently only local.
  
  var bot = new TelegramBot()
  
  console.log(bot)
  // This does not print a complete JSON of the object. It misses stuff like 
  constructor, method, prototype and super_.
  </code></pre>
  
  <p>Is there some way or npm module that prints a JSON compatible output of the object?</p>
  
  <p>My only work around so far is console logging it out like this and repeatedly checking the log and printing out another but I think it'll be a lot of easier by having a JSON export and using a JSON online viewer that views like a directory tree.</p>
  
  <pre><code>console.log(`
     TelegramBot:
     &gt; ${Object.getOwnPropertyNames(TelegramBot)}
  
     TelegramBot.prototype:
     &gt; ${Object.getOwnPropertyNames(TelegramBot.prototype)}
  
     TelegramBot.prototype.constructor:
     &gt; ${Object.getOwnPropertyNames(TelegramBot.prototype.constructor)}
  
     TelegramBot.prototype.constructor.super_:
     &gt; ${Object.getOwnPropertyNames(TelegramBot.prototype.constructor.super_)}
  `)
  </code></pre>
  
  <p>I'm aware functions can't be seen with <code>JSON.parse()</code>. I don't mind if they appear as a string like "Anonymous Function()" or "FunctionWithAName()". Or something like this.</p>
  
  <p>I'm doing this since I'm having another go trying to learn prototypes and I've used <code>util.inherits(TelegramBot, EventEmitter)</code> in the TelegramBot object.</p>
  
  <p>To avoid name clashes between TelegramBot methods I've made and the super class of EventEmitter names. I'd like to keep a clear view of the whole object structure. Or do I not have to worry since they use this variable shadowing thing? If I'm correct it checks the object's instance first, then it's prototype. Not sure if EventEmitter prototype checked first or TelegramBot's.</p>