How can I loop a nested json and show all the data in the laravel blade

Actually I am having trouble looping a complex JSON. look at this JSON structure.

{
    "transactionId": "blablablabla",
    "campaigns": [
        {
            "affiliateNumbers": [
                {
                    "phoneNumber": "+345345",
                    "localNumber": "(888) 34534534534-456456",
                    "displayNumber": "6345345345",
                    "assignmentSettings": {
                        "countryCode": "US",
                        "isTollFree": true,
                        "limit": 5
                    },
                    "deallocFlag": false,
                    "failedRechargeAttempts": 0,
                    "isCarrierNumber": false,
                    "carrierNumberId": "",
                    "isInternalOnly": false,
                    "affiliate": {
                        "accountId": "546546",
                        "id": "asddasdasd",
                        "subId": "",
                        "createNumbers": false,
                        "userIds": [
                            "475f197a-d05d-41ce-adf8-17e4fe430e46"
                        ],
                        "isSelf": false,
                        "isCriteriaInverted": false,
                        "name": "Poshnee tech SMC PVT LTD",
                        "enabled": true,
                        "version": 1
                    }
                }
            ]
        }
    ]
}

I tried so many times I am not going to include my code cause I am really ashamed of getting laughed at. So what I want is to loop this JSON and show it in a Laravel blade.php file. How can I achieve that? IS there any easy solution for me?

Here is my Controller:

public function fetch_all_campaigns(): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application
{
    $headers = [
        "Content-Type" => "application/json",
        "Authorization" => "Token ****"
    ];

    $campaigns = Http::get(
        "https://api.ringba.com/v2/XXXXXXXXXXXXXXXXXXX/campaigns",
        $headers
    );

    return view("Dashboard.Campaigns.campaigns", [
        "campaigns" => $campaigns
    ]);
}


Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation