question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dumping objects outputs [object Object]

See original GitHub issue

If you pass an object instead of a string, what gets dumped is [object Object] instead of the actual dump of that object. One solution could be to possibly check if it’s of type ‘object’ and if so, either just return the object unstyled, or JSON.stringify() it, but I’m not sure that’s ideal.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:17
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

28reactions
sindresorhuscommented, Jul 13, 2016

Not interested in changing that behavior. It’s been like that for years and you’re the first to complain. If I had done it again I would have typechecked the input and thrown a TypeError, but that’s not worth doing a breaking change over.

13reactions
Qix-commented, Jul 13, 2016

@HillTravis for the record, you could always do

console.log(require('util').inspect(obj, {colors:true, depth:null}));
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dump Object in JavaScript - Linux Hint
The “JSON.stringify()” method is used to transform a JavaScript object into a string. This method can be applied to dump the object as...
Read more >
Using ObjectDumper - How to Dump Objects in C# - CodinGame
The idea of the object dumper is that it recursively loops on the object's properties through reflection and collects all data underlying that...
Read more >
How to Dump Object for Debugging Purposes in C#? - Coding ...
You can dump object in C# using either reflection or serialization, you can either use ObjectDumper, JSON Serializer or YAML Serializer.
Read more >
Object Dump JavaScript - Stack Overflow
In Node. js this just prints a literal "%o" in output. Merely separating the string from the object, however, does dump a human-readable...
Read more >
Dump Object (DMPOBJ) - IBM
The Dump Object (DMPOBJ) command dumps the contents or attributes of the ... then the output is not spooled but printed directly; and,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found