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

  • SEARCH
  • Home
  • 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 8466485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:21:25+00:00 2026-06-10T15:21:25+00:00

There are 4 arrays in Ruby array1 = [label1.1, label1.2, label1.3, label1.4] array2 =

  • 0

There are 4 arrays in Ruby

array1 = ["label1.1", "label1.2", "label1.3", "label1.4"]
array2 = ["data1.1", "data1.2", "data1.3", "data1.4"]

array3 = ["label2.1", "label2.2", "label2.3", "label2.4"]
array4 = ["data2.1", "data2.2", "data2.3", "data2.4"]

What I need to do is to get the result array of hash looking

[ {key1=>"label1.1", value1=>"data1.1" }, 
  {key1=>"label1.2", value1=>"data1.2" },
  {key1=>"label1.3", value1=>"data1.3" },
  {key1=>"label1.4", value1=>"data1.4" },

  {key1=>"label2.1", value1=>"data2.1" },
  {key1=>"label2.2", value1=>"data2.2" },
  {key1=>"label2.3", value1=>"data2.3" },
  {key1=>"label2.4", value1=>"data2.4" }
]

Your thoughts?

  • 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-10T15:21:27+00:00Added an answer on June 10, 2026 at 3:21 pm
    (array1 + array3).zip(array2 + array4).map {|k, v| { key1: k, value1: v } }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are some arrays in Ruby (is this case there 4 array) array1 =
Given the array, i need to find how many monotonically increasing Sub-arrays there are
Is there an equivalent for ruby's array[n..m] in JavaScript? For example: >> a =
I've imported a dataset from CSV into Ruby as an array of arrays (each
I have a Ruby array containing some string values. I need to: Find all
I need to bring an array of ruby objects in JSON. I will need
Is there a Java equivalent to Ruby's Array#product method, or a way of doing
Is there a way to dynamically create arrays in Ruby? For example, let's say
In Ruby, given an array-of-arrays representing a 2D grid of numbers, how would you
Is there a quick way to get every other entry in an Array in

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.