I have a JSON object data in a JSP file and have passed this data to a JavaScript function through a hyperlink onclick method. The alert box displays properly, but the issue is that I want to extract the URLs in the JSON object and convert them into an array.
The actual data in the JavaScript function looks like this:
[Image{url='/images/HH/Images/US/NYC/NYC-MEL-1.jpg', description='Exterior', alt='null', sortOrder=1, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-9.jpg', description='Exterior', alt='null', sortOrder=1, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-11.jpg', description='Lobby', alt='null', sortOrder=4, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-5.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-6.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-7.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-8.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-10.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-3.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-2.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-4.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}]
The above text contains a List of Image Objects that contain URLs, alt text, descriptions, and more.
I need a JavaScript solution to iterate through the URLs and convert them into an array.
Could you please suggest an answer for me?
Thanks, Ram Prasad G 08527960397