定义数组:

array(3) {
  ["name"] => string(9) "郭少锋"
  ["nick"] => string(21) "郭少锋 18965668180"
  ["contact"] => array(2) {
    ["email"] => string(16) "597048937@qq.com"
    ["website"] => string(20) "http://597048937.com"
  }
}

数组 转为 JSON:$jsonTxt = json_encode($txtAarry);

echo $jsonTxt;

{"name":"\u90ed\u5c11\u950b","nick":"\u90ed\u5c11\u950b 18965668180","contact":{"email":"597048937@qq.com","website":"http:\/\/597048937.com"}}

JSON 转为 数组:$obj = json_decode($jsonTxt);

print_r($obj);

stdClass Object ( [name] => 郭少锋 [nick] => 郭少锋 18965668180 [contact] => stdClass Object ( [email] => 597048937@qq.com [website] => http://597048937.com ) )

$this->data = dump($obj);

object(stdClass)#5 (3) {
  ["name"] => string(9) "郭少锋"
  ["nick"] => string(21) "郭少锋 18965668180"
  ["contact"] => object(stdClass)#6 (2) {
    ["email"] => string(16) "597048937@qq.com"
    ["website"] => string(20) "http://597048937.com"
  }
}