Json-array please i need help

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”: [
“source”: 1,
“inactive”: true,
“protected”: false,
“closing”: “oki”,
“destination”: [
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?

“build_version”: “String”,
“external_version”: “String”,
“release_name”: “String”

here i don’t have arrey but only key-value,

Checkout this example Guide: How to get JSON data from an Api using dictionaries (and show it on a dynamic cardview)


unfortunately I cannot use “web” but only “curl” from the “KIO4Terminal” component

This is just a example to manipulate the json understand the concept from this guide .
like this


It’s me Again :smiley:
There are many examples here in comunnity about This subject :mag:


Not all android versions have curl so maybe it is better to use Web component to get api response. To create your curl blocks just use


good evening,
unfortunately i am having problems for jsons with multi arrays the Json i have:

if in the array “rules” I want to take the value of the “type” key (abce)
“last_persisted_time”: 1644780044000,
“username_count”: 0,
“description”: “wyuiuwuyuwuyiywuiuywuyiu Command Line\n containing Process Create\n”,
"rules": [
“id”: 123456,
"type": "abce"
“event_count”: 2,
“flow_count”: 0,
“assigned_to”: “user”,
“security_category_count”: 2,
“follow_up”: false,
“source_address”: [
“source_count”: 1,
“inactive”: true,
“protected”: false,
“closing_user”: “user”,
“destination_networks”: [
“source_network”: “test”,
“category_count”: 2,
“close_time”: 1644779999000,
“remote_destination_count”: 0,
“start_time”: 1644779755198,
“magnitude”: 5,
“last_updated_time”: 1644779755416,
“credibility”: 3,
“id”: 34436,
“categories”: [
“severity”: 5,
“policy_category_count”: 0,
“wow”: [
“type_name”: “about”,
“type_id”: 18,
“name”: “reddeerteyretyetreytret :: klkoekoeokoke”,
“id”: 2113
“type_name”: “how”,
“type_id”: 12,
“name”: “test”,
“id”: 11277
“closing_reason_id”: 305,
“device_count”: 2,
“first_persisted_time”: 1644779756000,
“offense_type”: 69,
“relevance”: 6,
“domain_id”: 7,
“offense_source”: “test”,
“local_destination_address”: [
“local_destination_count”: 1,
“status”: “CLOSED”

use as explained in the guide:

but I get the following error:
“List of pairs to dict: the list xxxx----xxxx is not a well-formed of pairs”

I think because he can’t create a dictionary …
help me please i can’t get out of it

Using [Free] Json To Dictionary Extension

1 Like

if you come to Italy in Rome, I’ll offer you a coffee, thank you very much :smiley:

1 Like