Check expected type after JSON decode instead of checking what is not expected.

This will also allow "true" and "false" as filenames instead of only "null".