0
How to extract decode JSON from REDCAP Array with PHP
Hallo there, I have an JSON Export from a REDCAP and it started as a nested ARRAY. I use json_decode, but when I print the result I get ERROR. Here is the Array: [{"record_id":"13","lastname":"Mustermann","first_name":"Json","dob":"1948-10-12","case_number":"1366613"}] My Code is: $deco = json_decode($json); print $deco; This line gives an error. What am I doing wrong?! Thank you
4 Answers
+ 2
If you decode to object, try this:
$a = $jsonObj[0]->record_id;
If array:
$a = $jsonArr[0]["record_id"];
+ 1
Hi, print and echo can't display array or object. Try to use debug function, like print_r or var_dump.
Also, please note that json_decode returns object. If you want to get result as array, you can pass second argument as true.
0
Hello World thank you! Now I want to assign some data from this jason to variables. like $a = $demo{âdobâ}; and then echo $demo; This dost work either. How can I assign?
0
Hello World thank you! it works!