(#4561) Support structured facts

Add the option stringify_facts which defaults to true. If it is turned
on the current behaviour with turning facts into strings is kept.
If it is false facts are sanitized and only converted to strings if they
aren't booleans, numerics, arrays and hashes. It does this sanitizing in
a nested manner for arrays and hashes.
Merge branch 'dalen-4561_structured_facts'

* dalen-4561_structured_facts:
  (#4561) Support structured facts

closes #1578