There's a facility of many programming languages for outputting a serialized version of a data structure, that's text / human-readable. This is VERY useful for debugging. When the serialized version is eval()able, it can even function as self-deserializing code, though that isn't necessary for debugging purposes.

In general, if you're using an IDE, you may be able to just use the watch-variable-interactive-expansion feature. However, this doesn't work if you want to dump variables to log files, or various other specific situations.