Declare Array of Arrays And Convert To JSON Using PHP
Here is the array of arrays declaration.
$data = array( 'title' => 'Title', 'name' => 'Name', 'comments' => array( 0 => array( 'name' => 'John Doe', 'email' => 'john@example.com' ), 1 => array( 'name' => 'Jane Doe', 'email' => 'jane@example.com' ), ) );JSON output using json_encode() function of PHP
{ title: 'Title', name: "Name", comments: [ { name: "John Doe", email: "john@example.com" }, { name: "Jane Doe", email: "jane@example.com" } ] }
Comments
Post a Comment