xiehongguang
xiehongguang

Reputation: 1414

how to parse this json data in php (replace " with ")

I get a json data from Android App which looks like

{"NickName":"Tom"}

how to get NickName data with php?

Upvotes: 0

Views: 974

Answers (1)

Niklesh Raut
Niklesh Raut

Reputation: 34914

use html_entity_decode to make json data and json_decode to get name

Check in fiddle : https://eval.in/780633

  <?php
   $str = "{&quot;NickName&quot;:&quot;Tom&quot;}";
   echo $text = html_entity_decode($str);
   echo "\n";
   echo json_decode("$text")->NickName;
  ?>

Upvotes: 2

Related Questions