Conditional object wrapping to clean up raw js output.