I am using php json_decode to parse API response and then json_encode to send response to client.
In a third party API call I am getting JSON response in which there is a key with value having html tags and html contents. When I print that data I can see those tags, but after json_decode, I can not see those tags, so that I am unable to keep those tags intact. I want that html content to go to database as it is [without any change at all].
$result = curlGetWithHeaders("API URL", "Parameters for that URL");
$data = json_decode($result);
So in $result I can see html tags but not in $data.
And var_dump($data) says that it is string.
Response is =
{"array":{"id":1,"title":"Title","short_title":"abcd","description":"<ul><li>0</li><li>A</li><li>B</li><li>C</li><li>D</li>"}}
and after using json_decode I am getting description as pasred html.
deals] => Array
(
[0] => stdClass Object
(
[deal] => stdClass Object
(
[id] => 1
[title] => title
[short_title] => abcd
[description] => 0
• A
• B
• C
str_replaceto replace<with<and>with>json_encodebut onlyjson_decodeis asked about. Which is it now?