Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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}
 
PREVIOUS NEXT
Tagged: #convert #stdclass #json #php
ADD COMMENT
Topic
Name
4+1 =