Json to base64 javascript