Add prettyprinting for JSON.

This commit adds prettyprinting to JSON output in two ways:
    1. It creates a 'settings' dict in the JSON representation module
       that contains kwargs to be passed to json.dumps.
    2. When the app is in debug mode (app.debug is True), then the
       representation will set reasonable defaults for prettyprinting
       JSON - specifically, indenting by 4 spaces and sorting by keys.
       Note that both of these values will not be set if there is an
       existing setting for them.

Tests are also added.
Merge branch 'master' into andrew-prettyprint-json