Refactor for cleaning JSON lists

Created a small helping procedure to print out arrays of WP_Objects,
takes the list as the first argument and the name to associate with the
JSON in the other. It is assumed that we're already in the process of
printing out a JSON object.