I have an array of JSON arrays whose values I am trying to encrypt with CryptoJS and then print for use in another file, where these values should be decrypted using a user-give
That error message usually means the data wasn't decrypted correctly, and the resulting plaintext bytes don't form valid UTF-8 characters.
A couple things to check:
item[key]
is a string before encrypting. CryptoJS can't encrypt JSON objects. You'll have to serialize it first.