Answers for "convert stdclass to json in php"

PHP
-1

convert stdclass to json in php

$stdClass = new stdClass();
$stdClass->name = "avatar";
$stdClass->age = 31;
$json_data = json_encode ((array) $stdClass);
print_r($json_data); //{"name":"avatar","age":31}
Posted by: Guest on July-27-2020

Code answers related to "convert stdclass to json in php"

Browse Popular Code Answers by Language