php json to object to string code example
Example 1: object to string php
(string)$yourObject;
Example 2: 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}