JSON value not showing in HTML by PHP

There are few possibility why JSON data not being displayed properly.

To debug your data, use

 print_r($your_data);die(); 

If print_r shows empty or nothing, use

 var_dump($your_data);die();

Output:

string '{"en":"Home","fr":"Office","cn":"bar"}' (length=1

Possibility 1) – json data being encoded to html code. Some CMS will encoded the json data output.

To solve this html entity issue, decode the data like example below:

json_decode(html_entity_decode($your_data);

By Keenlio, December 16, 2013

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *


2 + = eight

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>