returning json from a web service, seems to add slashes

Re: returning json from a web service, seems to add slashes

by Tim Hunt -
Number of replies: 0
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

If you want to return an object, return $obj.

json_encode($obj) is a string, and in order to safely send that string back to the client, special characters have to be escaped, and that is what is happening. However, you don't want a string, so don't do that.

Average of ratings: Useful (1)