I wrote about this in a blog post called “User empowerment of FFI in PureScript”

You should read these links at minimum:

I have some examples of various ways of doing FFI here: https://github.com/justinwoo/purescript-ffi-intro

“What if I need to validate inputs from FFI?”

Use the Foreign type from the purescript-foreign library and see the next section, which is not only about JSON but also about foreign JS values.