How do I output a JSON variable?

Posted 1 month ago by ChrisF79

I have the JSON below. All I am trying to do is output "Theme Reviewer" as the author name. I tried

$post->_embedded['author']['0']['name']

That doesn't output it. I've tried other variations like the 0 not having ' around it yet nothing is working. Please help!

The variable is at the end of this JSON:

array:10 [▼
  0 => {#710 ▼
    +"id": 1780
    +"date": "2018-11-03T12:20:00"
    +"date_gmt": "2018-11-03T12:20:00"
    +"guid": {#711 ▶}
    +"modified": "2019-04-19T01:02:23"
    +"modified_gmt": "2019-04-19T01:02:23"
    +"slug": "block-image"
    +"status": "publish"
    +"type": "post"
    +"link": "https://blog.listingnaples.com/block-image/"
    +"title": {#712 ▶}
    +"content": {#713 ▶}
    +"excerpt": {#714 ▶}
    +"author": 3
    +"featured_media": 1022
    +"comment_status": "open"
    +"ping_status": "open"
    +"sticky": false
    +"template": ""
    +"format": "standard"
    +"meta": {#715 ▶}
    +"categories": array:1 [▶]
    +"tags": array:1 [▶]
    +"fimg_url": "https://blog.listingnaples.com/wp-content/uploads/2013/03/featured-image-horizontal-1.jpg"
    +"_links": {#717 ▶}
    +"_embedded": {#734 ▼
      +"author": array:1 [▼
        0 => {#729 ▼
          +"id": 3
          +"name": "Theme Reviewer"

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.