Good evening,
I state that I have read many things on the subject, but I can not find a solution, I hope you can help me.
I am creating an application that makes API call and receives response JSON.
Unfortunately the JSON it receives often contains no arrey, other times they contain only one and other times more arrey …
I can’t figure out how to manage everything automatically, because it is clear that if the app expects only one arrey and many arrive, it cannot handle the answer.
the app will then have to add value to the fields. These fields are on three lines, so an arrey will have to value a line according to the key and value he will choose from the payload etc …
example 1:
how do i indicate if i want a value of a certain arrey:
[
{
“time”: 1644688546000,
“username_count”: 0,
“description”: “EXAMPLE 1”,
“rules”: [
{
“id”: 123456,
“type”: “Rule1”
}
],
“red”: 2,
“brown”: 0,
“white”: “good”,
“security”: 2,
“follow”: false,
“source_address_ids”: [
1234567
],
“source”: 1,
“inactive”: true,
“protected”: false,
“closing”: “oki”,
“destination”: [
“other”
],
etc…
i thought the solution may be by indicating the values in which array they belong
but the first “time” field does not have an array, how can I then get its value?
EXAMPLE 2
{
“build_version”: “String”,
“external_version”: “String”,
“release_name”: “String”
}
here i don’t have arrey but only key-value,