Handle data types besides strings

So far we assumed hiera outputs only strings but yaml also handles lists
and dicts. Unparsing this from the returned string is cumbersome so use
hiera's relatively new --format option instead. We use JSON instead of
YAML since the YAML part is even newer.