[Solved] Help in getting an Object from a response

I am not able to get “image_url” from this response:

{
  "correlation_id": "ID",
  "error": false,
  "response": {
    "image_url": "https://example/images/000000.png"
  }
}

Code:
rtyrtyrty

How do you know you’re not getting that value? Have you tried assigning the result of those blocks to a label’s text?

I can’t see the rest of your blocks but what you posted above looks correct for that JSON response. I formatted the JSON using the </> button in the toolbar for you because otherwise the smart quotes can invalidate the JSON when checking it at sites like https://codebeautify.org/jsonviewer. At that site, the JSON tree shows the path to the “image_url” property to be object → response → image_url which is how you have the blocks set up.

2 Likes

In my project, the image component which had an assigned value of image_url was not showing any image.
Whole Block:
fghfghfghfgh

But that could be for several reasons. So:

  1. What value do you get when you assign those blocks to a label? It can actually be better to use a text input because you can copy and paste from it.

  2. What happens when you browse to the value in the label in Chrome or another browser (not in Thunkable Live)?

Thanks! Actually the image loaded very late.

Can you help me with this one also?
How do I get the name object in 1st Book detail?

[
  {
    "book_id": 53152636,
    "name": "Mexican Gothic",
    "author": "Silvia Moreno-Garci",
    "votes": 85626,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1607462569l/53152636._SY475_.jpg",
    "url": "https://www.goodreads.com/book/show/53152636-mexican-gothic?from_choice=true"
  },
  {
    "book_id": 48838041,
    "name": "If It Bleeds",
    "author": "Stephen Kin",
    "votes": 47552,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1598366651l/48838041._SY475_.jpg",
    "url": "https://www.goodreads.com/book/show/48838041-if-it-bleeds?from_choice=true"
  },
  {
    "book_id": 44077284,
    "name": "The Southern Book Club's Guide to Slaying Vampires",
    "author": "Grady Hendri",
    "votes": 41455,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1573175023l/44077284.jpg",
    "url": "https://www.goodreads.com/book/show/44077284-the-southern-book-club-s-guide-to-slaying-vampires?from_choice=true"
  },
  {
    "book_id": 49789629,
    "name": "The Year of the Witching",
    "author": "Alexis Henderso",
    "votes": 22173,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1576699031l/49789629.jpg",
    "url": "https://www.goodreads.com/book/show/49789629-the-year-of-the-witching?from_choice=true"
  },
  {
    "book_id": 52180399,
    "name": "The Only Good Indians",
    "author": "Stephen Graham Jone",
    "votes": 17021,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1601545259l/52180399._SY475_.jpg",
    "url": "https://www.goodreads.com/book/show/52180399-the-only-good-indians?from_choice=true"
  },
  {
    "book_id": 52454426,
    "name": "Devolution",
    "author": "Max Brook",
    "votes": 10152,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1566875204l/52454426._SX318_SY475_.jpg",
    "url": "https://www.goodreads.com/book/show/52454426-devolution?from_choice=true"
  },
  {
    "book_id": 50892288,
    "name": "The Hollow Places",
    "author": "T. Kingfishe",
    "votes": 8801,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1600022295l/50892288.jpg",
    "url": "https://www.goodreads.com/book/show/50892288-the-hollow-places?from_choice=true"
  },
  {
    "book_id": 50496875,
    "name": "Plain Bad Heroines",
    "author": "Emily M. Danfort",
    "votes": 8717,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1584977118l/50496875.jpg",
    "url": "https://www.goodreads.com/book/show/50496875-plain-bad-heroines?from_choice=true"
  },
  {
    "book_id": 44564972,
    "name": "Malorie",
    "author": "Josh Malerma",
    "votes": 7216,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1585099052l/44564972.jpg",
    "url": "https://www.goodreads.com/book/show/44564972-malorie?from_choice=true"
  },
  {
    "book_id": 49090884,
    "name": "Tender is the Flesh",
    "author": "Agustina Bazterric",
    "votes": 6275,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1594563107l/49090884.jpg",
    "url": "https://www.goodreads.com/book/show/49090884-tender-is-the-flesh?from_choice=true"
  },
  {
    "book_id": 52594581,
    "name": "The Hollow Ones",
    "author": "Guillermo del Tor",
    "votes": 2429,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1571698404l/52594581.jpg",
    "url": "https://www.goodreads.com/book/show/52594581-the-hollow-ones?from_choice=true"
  },
  {
    "book_id": 52703177,
    "name": "The Bright Lands",
    "author": "John Fra",
    "votes": 2282,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1574745711l/52703177.jpg",
    "url": "https://www.goodreads.com/book/show/52703177-the-bright-lands?from_choice=true"
  },
  {
    "book_id": 51166519,
    "name": "Lakewood",
    "author": "Megan Gidding",
    "votes": 2215,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1579612241l/51166519._SX318_SY475_.jpg",
    "url": "https://www.goodreads.com/book/show/51166519-lakewood?from_choice=true"
  },
  {
    "book_id": 52581895,
    "name": "Survivor Song",
    "author": "Paul Trembla",
    "votes": 2096,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1575564155l/52581895.jpg",
    "url": "https://www.goodreads.com/book/show/52581895-survivor-song?from_choice=true"
  },
  {
    "book_id": 49247242,
    "name": "Ring Shout",
    "author": "P. Djèlí Clar",
    "votes": 1305,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1580134382l/49247242.jpg",
    "url": "https://www.goodreads.com/book/show/49247242-ring-shout?from_choice=true"
  },
  {
    "book_id": 49295297,
    "name": "The Loop",
    "author": "Jeremy Robert Johnso",
    "votes": 1114,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1599399820l/49295297.jpg",
    "url": "https://www.goodreads.com/book/show/49295297-the-loop?from_choice=true"
  },
  {
    "book_id": 50607901,
    "name": "The Ghost Tree",
    "author": "Christina Henr",
    "votes": 672,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1586544909l/50607901.jpg",
    "url": "https://www.goodreads.com/book/show/50607901-the-ghost-tree?from_choice=true"
  },
  {
    "book_id": 53869658,
    "name": "Secret Santa",
    "author": "Andrew Shaffe",
    "votes": 427,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1598985296l/53869658.jpg",
    "url": "https://www.goodreads.com/book/show/53869658-secret-santa?from_choice=true"
  },
  {
    "book_id": 52622380,
    "name": "World Departed",
    "author": "Sarah Lyons Flemin",
    "votes": 383,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1584923508l/52622380._SY475_.jpg",
    "url": "https://www.goodreads.com/book/show/52622380-world-departed?from_choice=true"
  },
  {
    "book_id": 55456522,
    "name": "Houndings of Hell",
    "author": "Hunter Holme",
    "votes": 161,
    "cover": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1601089713l/55456522._SY475_.jpg",
    "url": "https://www.goodreads.com/book/show/55456522-houndings-of-hell?from_choice=true"
  }
]

I have a tutorial that explains how to parse JSON. I think you’ll find it helpful.