(PDB-809) Store top level structured fact data as JSON

This adds the storage of the top level facts that happen to be structured in a
new column of fact_values called `value_json`. This is provided so we can query
top level facts for the /facts endpoint in a performant way, without having
to also reassemble the pieces of values into a JSON object later on.

Signed-off-by: Ken Barber <ken@bob.sh>
In a way this is an inadvertent fix, not a bad thing. I've raised another commit that makes factsets use this top level cache also now - that makes the fix consistent across both endpoints. fact-nodes is still unable to deal with empty arrays and maps, but since it doesn't work with branches anyway this is not an inconsistency IMHO.