Hello All,
I am struggling allot of days now before reaching out here
My issue is that i have a json output from an API call but i am not able to handle the data as i would like.
In this data:
So i created a host added an httpagent and i was able to fetch the json.
Now what i would like to achieve is to create items via discovery and not by doing a $.[0].ChannelStatus.title for the first path and $.[1].ChannelStatus.title
but via discovery so that i in the end have the title and the active_source_id as a number to do the notifications on.
I am sorry maybe a noob question but i am really stuck
I am struggling allot of days now before reaching out here

My issue is that i have a json output from an API call but i am not able to handle the data as i would like.
In this data:
Code:
[
{
"ChannelStatus": {
"id": 1,
"active_source_id": 110,
"is_enabled": 1,
"program_number": 1,
"pmt_pid": 301,
"audio_pid": 1001,
"title": "Bla Main",
"enocded_bit_rate": 184284,
"encoding_mode_id": 18,
"up_time": 440590,
"modified": "1687347700092",
"SourcesStatus": [
{
"id": 5,
"title": "hello.mp3",
"source": "hello.mp3",
"interface_id": 0,
"source_channel_type_id": 2,
"priority": 3,
"mode_id": 4,
"modified": "1687347700092"
},
{
"id": 110,
"title": "Bla Main",
"source": "testtestetst",
"interface_id": 2,
"source_channel_type_id": 1,
"priority": 1,
"mode_id": 4,
"modified": "1687347700092"
},
{
"id": 112,
"title": "bla Backup",
"source": "blalalalala",
"interface_id": 2,
"source_channel_type_id": 1,
"priority": 2,
"mode_id": 4,
"modified": "1687347700092"
}
]
}
},
{
"ChannelStatus": {
"id": 2,
"active_source_id": 9,
"is_enabled": 1,
"program_number": 2,
"pmt_pid": 302,
"audio_pid": 1002,
"title": "this another Main",
"enocded_bit_rate": 193501,
"encoding_mode_id": 18,
"up_time": 440590,
"modified": "1687347700092",
"SourcesStatus": [
{
"id": 5,
"title": "hello.mp3",
"source": "hello.mp3",
"interface_id": 0,
"source_channel_type_id": 2,
"priority": 3,
"mode_id": 4,
"modified": "1687347700092"
},
{
"id": 9,
"title": "this another Main",
"source": "thisissomething",
"interface_id": 2,
"source_channel_type_id": 1,
"priority": 1,
"mode_id": 4,
"modified": "1687347700092"
}
]
}
}
]
Now what i would like to achieve is to create items via discovery and not by doing a $.[0].ChannelStatus.title for the first path and $.[1].ChannelStatus.title
but via discovery so that i in the end have the title and the active_source_id as a number to do the notifications on.
I am sorry maybe a noob question but i am really stuck

Comment