Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8326175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:41:03+00:00 2026-06-09T00:41:03+00:00

I have a current array of the below hash map, i have another array

  • 0

I have a current array of the below hash map, i have another array that i would like to insert into each hash by matching on the id.

 {"url"=>"http://ubuntu64:1990/getpages",
  "id"=>"32794",
  "version"=>"2",
  "title"=>"Creating a page",
  "space"=>"test",
  "parentId"=>"32782",
  "permissions"=>"0"}

The other array i want to add the ‘imageurl’ key/value based on the id, so something like (if id == id insert ‘imageurl’/’someurl.jpg}

{"id"=>"32794", "imageurl" => "someurl.jpg}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:41:04+00:00Added an answer on June 9, 2026 at 12:41 am
    array = [...] #Declare your array with the "big" hashes here
    array2 = [...] #Declare your array with the hash containing the imageurl key here
    
    array.each do |a|
      array2.each do |a2|
        if a[:id] == a2[:id]
          a[:imageurl] = a2[:imageurl]
          break #We found it
        end
      end
    end
    

    Should do the trick … maybe there’s a smarter way to do it though

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the multidimensional array below, I would like to merge arrays that have the
I have the below HTML string, and I would like to turn it into
I have an array like the one below array( hgfh => array(s => 2011-11-28T07:00-04:00,
I have an array like this (below is the var_dump) array 0 => object(stdClass)[11]
I have array with times like below 00:00, 01:25, 02:00, 02:35, 04:35, 05:00, 06:00,
I have an array containing specific times and I want when the current time
I have an array with a series of event IDs organized like this: $event['year']['month']['day']
I have a multi-part array that I want to grab a piece of and
I have a 2D array of integers that represent groupings (crystal grains) on a
I have a 1-dimensional array that fills up a table of 40 random elements

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.