Looking for a quick cut and paste, I found crazy composer modules and overcomplicated blog articles.  Thought I'd help Occam out a bit with this very simple blog entry!  BTW I lied, we're going to skip JsonModel.


Sorry for the crappy indentation, trying to make it fit in Squarespace.  JSON_PRETTY_PRINT came along with PHP 5.4


        public function prettyJsonAction()
            $contacts = array( 'foo' => 'bar' );
            $response = $this->getResponse();

                ->addHeaderLine( 'Content-Type', 'application/json' );

                    json_encode( $contacts, JSON_PRETTY_PRINT )

            return $response;