Unexpected token 'o', "[object Obj"… is not a valid JSON – PHP
I have written a function in PHP which takes product information and user's desired calories information from a database and puts all of the information in an array. Afterwards it's encoded in JSON. Then the PHP file is used in…