-2

I have a string variable in this format:

$array = '[{"name":"jack","address":"who knows"},{"name":"jill","address":"who knows too"}]';

how can I get value from

$array[0]['name']; //value is 'jack'
jack williams
  • 37
  • 1
  • 10

1 Answers1

1

https://juderosario.com/2016/09/01/parsing-json-with-php/

ok I get it from there

$json = '[ {"id":"1", "name":"foo" }, {"id":"2", "name":"bar" } ]';
$baz = json_decode($json,true);

echo($baz[1]['name']); //bar
jack williams
  • 37
  • 1
  • 10