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

107
Views
Convert encoded array to jquery with embd CRS as a Object using jquery

let images = ["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg"]

Convert this Encoded Array to this using JQuery..... I have images encoded array, I want to add src: images like I mention down in the items collection.

          {
            src: '1.jpg'
          },
          {
            src: '2.jpg'
          },
          {
            src: '3.jpg'
          },
          {
            src: '4.jpg'
          },
          {
            src: '5.jpg'
          }
        ],```
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

just try this

var data= images.map(obj=> ({"src" : obj}));

output

[
  {
    "src": "1.jpg"
  },
  {
    "src": "2.jpg"
  },
  {
    "src": "3.jpg"
  },
  {
    "src": "4.jpg"
  },
  {
    "src": "5.jpg"
  }
]
about 4 years ago · Juan Pablo Isaza Report

0

Here's the jQuery equivalent

let images = ["1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg"];
let obj = {
  items: $.map(images, function(o) {
    return {
      src: o
    }
  })
}
console.log(obj)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

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!