“PHP -String in JSON konvertieren” Code-Antworten

Konvertieren Sie die JSON -String in JSON -Objekt in Laravel

 $manage = json_decode($request->stdin, true);
 print_r($manage);
Famous Frog

PHP JSON_DECODE

$personJSON = '{"name":"Johny Carson","title":"CTO"}';

$person = json_decode($personJSON);

echo $person->name; // Johny Carson
Grepper

STDCLASS in JSON in PHP konvertieren

$stdClass = new stdClass();
$stdClass->name = "avatar";
$stdClass->age = 31;
$json_data = json_encode ((array) $stdClass);
print_r($json_data); //{"name":"avatar","age":31}
Arun Upadhyay

PHP -String in JSON konvertieren

$data = '{"Coords":[{"Accuracy":"65","Latitude":"53.277720488429026","Longitude":"-9.012038778269686","Timestamp":"Fri Jul 05 2013 11:59:34 GMT+0100 (IST)"},{"Accuracy":"65","Latitude":"53.277720488429026","Longitude":"-9.012038778269686","Timestamp":"Fri Jul 05 2013 11:59:34 GMT+0100 (IST)"},{"Accuracy":"65","Latitude":"53.27770755361785","Longitude":"-9.011979642121824","Timestamp":"Fri Jul 05 2013 12:02:09 GMT+0100 (IST)"},{"Accuracy":"65","Latitude":"53.27769091555766","Longitude":"-9.012051410095722","Timestamp":"Fri Jul 05 2013 12:02:17 GMT+0100 (IST)"},{"Accuracy":"65","Latitude":"53.27769091555766","Longitude":"-9.012051410095722","Timestamp":"Fri Jul 05 2013 12:02:17 GMT+0100 (IST)"}]}';

$manage = json_decode($data, true);
patrick204nqh

Konvertieren Sie zu JSON PHP

<?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);
?>
CoderHomie

JSON PHPH analysieren

echo json_decode("[1,2,3]")[0];
1337

Ähnliche Antworten wie “PHP -String in JSON konvertieren”

Fragen ähnlich wie “PHP -String in JSON konvertieren”

Weitere verwandte Antworten zu “PHP -String in JSON konvertieren” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen