To convert an Array to JSON in PHP, we use json_encode() function. The function is used to encode a value to JSON format $arr = array ( 'Millie' => 'Eleven' , 'Mike' => 'Finn' , 'Gaten' => 'Dustin' , 'Noah' => 'Will' ); echo json_encode ( $arr ). " \n " ; Output : { "Millie" : "Eleven" , "Mike" : "Finn" , "Gaten" : "Dustin" , "Noah" : "Will" }
This blog is about solutions for PHP,Python,JavaScript,j query,HTML,CSS and Ubuntu.