I am in need of extracting the values of entries that share a common string. My goal is to locate campus0
, then iterate through each one to retrieve the text and link for link0
. This process needs to be repeated for every occurrence of campus
and link
.
Unfortunately, I cannot convert my JSON data into a multidimensional array as it is being sourced from another website.
The framework I am working with is AngularJS.
Below is an example of the JSON structure:
"campus_0_name": [
"Petone"
],
"campus_0_link_0_text": [
"Bachelor of Engineering Technology Degree (Level 7)"
],
"campus_0_link_0_url": [
"https://www.weltec.ac.nz/SUBJECTAREAS/EngineeringTechnology/BachelorofEngineeringTechnology/tabid/695/Default.aspx"
],
<!-- Additional JSON data for campus_0 omitted for brevity -->
"campus_1_link_0_text": [
"Bachelor of Engineering Technology Degree (Level 7) "
],
"campus_1_link_0_url": [
"https://www.weltec.ac.nz/SUBJECTAREAS/EngineeringTechnology/BachelorofEngineeringTechnology/tabid/695/Default.aspx"
],
<!-- Additional JSON data for campus_1 omitted for brevity -->
This is the desired output I want to achieve:
<div class="campus_0">
<dl class="link_0">
<dt class="text">Bachelor of Engineering Technology Degree (Level 7)</dt>
<dd class="url">"https://www.weltec.ac.nz/SUBJECTAREAS/EngineeringTechnology/BachelorofEngineeringTechnology/tabid/695/Default.aspx"</dd>
</dl>
<!-- Additional details for links within campus_0 omitted for brevity -->
</div>
<div class="campus_1">
<dl class="link_0">
<dt class="text">Bachelor of Engineering Technology Degree (Level 7)</dt>
<dd class="url">"https://www.weltec.ac.nz/SUBJECTAREAS/EngineeringTechnology/BachelorofEngineeringTechnology/tabid/695/Default.aspx"</dd>
</dl>
<!-- Additional details for links within campus_1 omitted for brevity -->
</div>