0

I have a JSON output that looks like this:

{"data":[{"QID":"Q1234","MgrQID":"5678","NTID":"blah"}]}

I am trying to access just the data within the square brackets, inside the data array?

I have tried $jsonVar['data'] and $jsonVar->data and neither of them are working.

Is there a way I can just get access to [{"QID":"Q1234","MgrQID":"5678","NTID":"blah"}]?

SBB
  • 8,560
  • 30
  • 108
  • 223

1 Answers1

0

Try this example:

<?php
$data = '{"data":[{"QID":"Q1234","MgrQID":"5678","NTID":"blah"}]}';
$test = json_decode($data, true);
echo json_encode($test['data']);
?>

Output:

[{"QID":"Q1234","MgrQID":"5678","NTID":"blah"}]
RaMeSh
  • 3,330
  • 2
  • 19
  • 31