The Web Blinders logo

Programming

JSON TO PHP OBJECT CONVERSION EXAMPLE

<?php

$jsonString='
{
    "host":"localhost",
    "user":"root",
    "password":"root",
    "database":"accounts",
    "mysqlport":3306
 }
';

$obj=json_decode($jsonString,false);
var_dump($obj);

/*

object(stdClass)#1 (5) {
  ["host"]=>
  string(9) "localhost"
  ["user"]=>
  string(4) "root"
  ["password"]=>
  string(4) "root"
  ["database"]=>
  string(8) "accounts"
  ["mysqlport"]=>
  int(3306)
}


*/ 

ALTERNATE TITLES

Convert json to object php

json_decode() php example

how to use json_decode() php

php tutorials

learn php

Need developers ?

if so, send a message.

thewebblinders@gmail.com

More Programming from our blog

SEARCH FOR ARTICLES