#that still doesn t look a JSON

1 messages · Page 1 of 1 (latest)

lean swallow
#

can we thread this

serene tinsel
#

sure

#

logs fields again outside of try/catch clause and after u set the var fields

#

also show the full err

lean swallow
#

lol

#

that would explain it

#

why are these \ in there

serene tinsel
#

did u put them in? cus it looks like u do

lean swallow
serene tinsel
#

ye. What u inputting the option is also not even a valid stringified obj

#

it shud look {"name": "value", "value": "value"} is a valid JSON.stringified obj

#

which u can parse properly.

lean swallow
#

looks like it its just an issue with how discord formats it somehow

#

going back to my original code and pasting this works fine { "name": "🤔", "value": "some of these properties have certain limits..." }

#

maybe it needs the line breaks

#
 if (interaction.options.get("fields")) {
                try {
                    var fields = JSON.parse(interaction.options.getString("fields"));
                } catch (error) {
                    await webhook.delete();
                    return await interaction.editReply({
                        content: "Json parse error! Please try again.",
                    });
                }
                embed.addFields(fields)
            }```