redactyl.js icon indicating copy to clipboard operation
redactyl.js copied to clipboard

"TypeError: A valid JSON object must be specified" error with arrays containing string values in redactyl.js after updating from version 1.4.3

Open FilipHavel opened this issue 1 year ago • 2 comments

Hello,

I am experiencing an error after updating to higher versions from version 1.4.3 in redactyl.js. Specifically, I am getting a TypeError: A valid JSON object must be specified error when inserting an object into the redact function. The object looks like this:

redactyl.redact({
    emails: ['[email protected]']
})

This object worked perfectly fine in version 1.4.3, but after updating, the error started to occur. Interestingly, if I create a property in the object that looks like this: emails: [{ email: '[email protected]' }], the error is not thrown. So, it seems that the problem is caused when the property is an array with string values.

Any help resolving this issue would be greatly appreciated.

Thank you.

FilipHavel avatar Mar 01 '23 07:03 FilipHavel

Hi, @FilipHavel . Thank you for posting this issue. I'm facing the same issue under the same circumstances.

Diorbert avatar Apr 24 '23 19:04 Diorbert

Looks to have been introduced through https://github.com/rcjpisani/redactyl.js/pull/14.

Happy to raise PR and get this sorted if needed!

CaLxCyMru avatar Jul 28 '23 15:07 CaLxCyMru