checking to see that request is not null in writejson