Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

How to convert a PHP array to JSON object

<?php
	// the php array
  	$array = array();
	$array['key1'] = "value1";
	$array['key2'] = "value2";
	$array['key3'] = "value3";

	// encode the php array into JSON format
	$json = json_encode($array);

	// check out the results
	var_dump($json);
?>
 
PREVIOUS NEXT
Tagged: #How #convert #PHP #array #JSON #object
ADD COMMENT
Topic
Name
5+4 =