(#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 kept in the format they were in which can also be
booleans, numerics, arrays and hashes.