Ask coding questions

← Back to all posts
Why do objects saved with Repl.it DB suddenly lose all their functions when saved?
stellos

Whenever I try to set a object with a function into the Replit KV DB, the function deletes, but not any other properties. Only the methods are deleted.

Is there any way to fix this? or is this a done on purpose by Repl.it (maybe for XSS issues?, I wouldn't know.)

Any help would be appreciated.

Voters
stellos
Comments
hotnewtop
JustCoding123

You can't store a function in json.

stellos

@JustCoding123 You can’t store a function in a JSON, but JavaScript supports functions within objects.

Does Replit DB only support JSON? (but that doesn’t make sense because Replit DB also allows strings)