Home > Article > Backend Development > How to create nested JSON objects in PHP?
The JSON structure can be created using the following code −
$json = json_encode(array( "client" => array( "build" => "1.0", "name" => "xxxx", "version" => "1.0" ), "protocolVersion" => 4, "data" => array( "distributorId" => "xxxx", "distributorPin" => "xxxx", "locale" => "en-US" ) ));
The above is the detailed content of How to create nested JSON objects in PHP?. For more information, please follow other related articles on the PHP Chinese website!