convert docs to json before sending