Allow true and false as filenames.

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".

Fixes #3631