Home > Backend Development > PHP Tutorial > How to create nested JSON objects in PHP?

How to create nested JSON objects in PHP?

WBOY
Release: 2023-08-19 13:48:01
forward
1260 people have browsed it

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"
   )
));
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template