Im adding data by stringifying a JSON object in using SDK var data = {
…channelUrl ? { channel_url: channelUrl } : {},
“user_ids”: allUserIds,
“name”: chatName,
//“channel_url”: channelUrl,
“is_distinct”: false, //The is_distinct property must be false in order to create a Supergroup. (Default: false)
“is_super”: true,
“is_public”: false,
“strict”: false, //if users must exist
“operator_ids”: [InitiatorId],
“block_sdk_user_channel_join”: true,
data: JSON.stringify({ mmChannelType: mmChannelType, …props })
}
const body = JSON.stringify(data)
const response = await fetch(url, {
method: ‘POST’,
headers: headersSendbird,
body: body
});
const responseData = await response.json();
When I read channel.data I get this string:
chatData: {0: ‘{’, 1: ‘"’, 2: ‘m’, 3: ‘m’, 4: ‘C’, 5: ‘h’, 6: ‘a’, 7: ‘n’, 8: ‘n’, 9: ‘e’, 10: ‘l’, 11: ‘T’, 12: ‘y’, 13: ‘p’, 14: ‘e’, 15: ‘"’, 16: ‘:’, 17: ‘"’, 18: ‘a’, 19: ‘n’, 20: ‘a’, 21: ‘l’, 22: ‘y’, 23: ‘t’, 24: ‘i’, 25: ‘c’, 26: ‘s’, 27: ‘-’, 28: ‘u’, 29: ‘s’, 30: ‘e’, 31: ‘r’, 32: ‘s’, 33: ‘"’, 34: ‘,’, 35: ‘"’, 36: ‘f’, 37: ‘o’, 38: ‘r’, 39: ‘m’, 40: ‘a’, 41: ‘t’, 42: ‘t’, 43: ‘e’, 44: ‘d’, 45: ‘_’, 46: ‘v’, 47: ‘a’, 48: ‘r’, 49: ‘i’, 50: ‘a’, 51: ‘b’, 52: ‘l’, 53: ‘e’, 54: ‘"’, 55: ‘:’, 56: ‘"’, 57: ‘G’, 58: ‘e’, 59: ‘n’, 60: ‘d’, 61: ‘e’, 62: ‘r’, 63: ‘"’, 64: ‘,’, 65: ‘"’, 66: ‘v’, 67: ‘a’, 68: ‘l’, 69: ‘u’, 70: ‘e’, 71: ‘"’, 72: ‘:’, 73: ‘"’, 74: ‘M’, 75: ‘a’, 76: ‘l’, 77: ‘e’, 78: ‘"’, 79: ‘,’, 80: ‘"’, 81: ‘t’, 82: ‘o’, 83: ‘t’, 84: ‘a’, 85: ‘l’, 86: ‘M’, 87: ‘e’, 88: ‘m’, 89: ‘b’, 90: ‘e’, 91: ‘r’, 92: ‘C’, 93: ‘o’, 94: ‘u’, 95: ‘n’, 96: ‘t’, 97: ‘I’, 98: ‘n’, 99: ‘C’, …}
I tried both passing a json object as is to param.data and stringifying it, either way I get this string. Why is this happening and How do I convert it back to a JSON object