How do you log content of a JSON object in Node.js?

后端 未结 7 1665
南旧
南旧 2020-12-12 09:38

Is it possible to print an objects contents e.g. methods and attributes in Node.js?

At the moment I\'m trying to print the session object and get the following:

相关标签:
7条回答
  • 2020-12-12 10:24

    This will work with any object:

        var util = require("util");
        console.log(util.inspect(myObject, {showHidden: false, depth: null}));
    
    0 讨论(0)
提交回复
热议问题