0👍
For php
you can use the json_encode()
function:
public function getSomeData() {
...
return json_encode('Sample & 'Code');
}
my assumption here is that if you did a var_dump('Sample & 'Code')
, it would print out 'Sample & 'Code'
Source:stackexchange.com