Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
How to pull out a portion from long string of metadata

This is my first time working with very long metadata in an api response. I would like to dig into the metadata and only pull out the image_url. I am wondering if there is an easier way to do so than splicing this extremely long string a bunch of times. In this example here is the metadata:

"metadata": "{\"id\":4647,\"name\":\"Pancake\",\"generation\":10,\"created_at\":\"2017-11-24T09:35:05.000Z\",\"birthday\":\"2017-11-24T00:00:00.000Z\",\"image_url\":\"https://img.cryptokitties.co/0x06012c8cf97bead5deae237070f9587f8e7a266d/4647.svg\",\"image_url_cdn\":\"https://img.cn.cryptokitties.co/0x06012c8cf97bead5deae237070f9587f8e7a266d/4647.svg\",\"color\":\"mintgreen\",\"kitty_type\":null,\"is_fancy\": .... etc

I only want the portion of the very long metadata string for image_url that is "https://img.cryptokitties.co/0x06012c8cf97bead5deae237070f9587f8e7a266d/4647.svg"

Any suggestions on what is the most efficient way to achieve this?

I tried How can we extract specific part of the string from long string? solution but I have lots of objects in my json response so I would need to iterate over everything and use a while loop. It seemed overly complicated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use JSON.parse() on the metadata string to get a JavaScript object. From that you can just index the object with the image_url key.

Example:

const metadata = JSON.parse(response['metadata'])
const imageUrl = metadata['image_url'];
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!