I'm decoding a json that I get from Notion's API in an associative array. When I var_dump it, it outputs as follows (with some information removed for security):
array(4) {
["object"]=>
string(4) "list"
["results"]=>
array(1) {
[0]=>
array(10) {
["object"]=>
string(4) "page"
["id"]=>
string(36) "dbid"
["created_time"]=>
string(24) "2021-11-17T10:06:00.000Z"
["last_edited_time"]=>
string(24) "2021-11-17T15:58:00.000Z"
["cover"]=>
NULL
["icon"]=>
NULL
["parent"]=>
array(2) {
["type"]=>
string(11) "database_id"
["database_id"]=>
string(36) "dbid"
}
["archived"]=>
bool(false)
["properties"]=>
array(2) {
["Meaning"]=>
array(3) {
["id"]=>
string(8) "%5Eny%3A"
["type"]=>
string(9) "rich_text"
["rich_text"]=>
array(1) {
[0]=>
array(5) {
["type"]=>
string(4) "text"
["text"]=>
array(2) {
["content"]=>
string(26) "This is a really big house"
["link"]=>
NULL
}
["annotations"]=>
array(6) {
["bold"]=>
bool(false)
["italic"]=>
bool(false)
["strikethrough"]=>
bool(false)
["underline"]=>
bool(false)
["code"]=>
bool(false)
["color"]=>
string(7) "default"
}
["plain_text"]=>
string(26) "This is a really big house"
["href"]=>
NULL
}
}
}
["DataElement"]=>
array(3) {
["id"]=>
string(5) "title"
["type"]=>
string(5) "title"
["title"]=>
array(1) {
[0]=>
array(5) {
["type"]=>
string(4) "text"
["text"]=>
array(2) {
["content"]=>
string(8) "bigHouse"
["link"]=>
NULL
}
["annotations"]=>
array(6) {
["bold"]=>
bool(false)
["italic"]=>
bool(false)
["strikethrough"]=>
bool(false)
["underline"]=>
bool(false)
["code"]=>
bool(false)
["color"]=>
string(7) "default"
}
["plain_text"]=>
string(8) "bigHouse"
["href"]=>
NULL
}
}
}
}
["url"]=>
string(63) "https://www.notion.so/bigHouse-connec"
}
}
["next_cursor"]=>
NULL
["has_more"]=>
bool(false)
}
I'm trying to get "This is a really big house" from the above associative array. I send the payload to notion that filters by the "DataElement" value "bigHouse". That works ok, but what I can't figure out is how to output "This is a really big house" from the associative array using PHP.
I have tried the following:
foreach($decoded as $key=>$val){
echo $key." "."| Value: ".$val."<br>";
}
This outputs:
object | Value: list
results | Value: Array
next_cursor | Value:
has_more | Value:
I'm not sure how to proceed from here. Any help would be appreciated. The name of the colum where "This is a really big house" is located on notion is: "Meaning".