0

How do I decode this json data using php to get individual values.

{"Alpha":["A","B","C","D","E","F"],"Beta":["1","2","3"],"Gamma": ["a","b","c"]}

Sara
  • 3
  • 2

1 Answers1

0

php has a function called json_decode

$json = '{"Alpha":["A","B","C","D","E","F"],"Beta":["1","2","3"],"Gamma": ["a","b","c"]}';

$json_array = json_decode($json,TRUE); // personally I prefer arrays which the TRUE adds

$alpha = $json_array['Alpha'];

$first_alpha_value = $alpha[0];

printf("A == %s\n",$first_alpha_value);
jbrahy
  • 4,228
  • 1
  • 42
  • 54