A shortcode must always **return** an output and nothing should be echo-ed by your shortcode function, because otherwise you'd get the issues like the ones in question (misplaced output and JSON responses error).

So you should **not** use `echo $response` and instead, use `return $response` in your `picts_ct_responses()` function.

For more details about WordPress shortcodes, see https://developer.wordpress.org/apis/handbook/shortcode/.