PHP has a var_dump() function which outputs the internal contents of an object, showing an object\'s type and content.
For example:
I like to use GSON because it's often already a dependency of the type of projects I'm working on:
public static String getDump(Object o) { return new GsonBuilder().setPrettyPrinting().create().toJson(o); }
Or substitute GSON for any other JSON library you use.