Optionally include explanations with results.

This depends on a feature flag that is only enabled in development by default,
but can be enabled explicitly in any environment: we don't want to generate
large chunks of JSON explanation in production unless we've got a very good
reason.
Only include debug fields that are present.

This stops us having to clutter up our tests with empty debug fields.