HomeBytesheetsUI TemplatesUI ToolsRoad MapsStack DiscussionByte Camp

How can I get the full object in nodejs console rather than [object]?

Suriyanarayana VMar 1, 2024.

I have this object, see below code, But when I try to show it using console.log(myObject), I receive this output: see code's output. How can I get the full object, including the content of property f?

const myObject = {
   "a":"a",
   "b":{
      "c":"c",
      "d":{
         "e":"e",
         "f":{
            "g":"g",
            "h":{
               "i":"i"
            }
         }
      }
   }
};

//output
 { a: 'a', b: { c: 'c',d: { e: 'e', f: [Object] } } }
Tags
Nodejs
console
object
Answers
Suriyanarayana VOct 16, 2024.Questioner

const util = require('util'); console.log(util.inspect(myObject, { depth: null })); This will print full object without limiting the depth

Your Answer👇🏻
10000
Back