change behavior for invalid header

If no header is found, or if the JSON is invaild, rather than returning an empty object of {} for the header, we return null for the header (the body still contains the entire document in this case). This makes it possible to tell if a header was properly defined in the document or not.