Fail on no prefix and fix prefix override

If the query param prefix wasn't provided, the JSON prefix would be overridden with empty string, this PR fixes that.

Also, fail if no prefix is provided.

@benbjohnson @mkobetic @charlescng