I am completely new to Angular and have a json file that contains different families. I need to retrieve the value associated with a specific family based on user input. For example, if the user inputs 'ciena', I should be able to return the json data for ciena only. The challenge is that I cannot rely on fixed positions like [0] due to uncertain user inputs.
import * as familyNames from '../../../assets/jsonFiles/deviceFamilyList.json';
---> this.families = familyNames['families'][0]; --this approach won't work for me.
{
"families": [
{
"**ciena**" : [
{"name": "Waveserver Family"},
{"name": "6500 Family"},
{"name": "5400 Family"},
{"name": "Z-Series"},
{"name": "3000 Family"},
{"name": "5000 Family"},
{"name": "6500 PTS"},
{"name": "8180"},
{"name": "8700"},
{"name": "Pluggable Transceiver Family"}
]
},
{
"**huawei**": []
}
]
}
Can anyone suggest how I can access the json data for a particular family, such as ciena or huawei, from the json file in my .ts file? I am working with Angular 8.
Thank you in advance for your assistance! :)