jeudi 18 juin 2020

Remove Illuminate\Http\JsonResponse Object from Array

I need your help to resolve one issue in laravel.

I am working on API development in laravel.

I have loop which works fine, but somehow, in response I am getting Illuminate\Http\JsonResponse Object Which is blank record. I want to remove this

Response is here:

Array
(
[0] => Array
    (
        [abcd] => Array
            (
                [0] => Array
                    (
                        [date-time] => 191018080000
                        [sub-type] => PQ
                        [comments] => hresfa
                        [parameter-list] => hresfa paraa
                        [state] => bad
                        [value] => 9200
                        [datetime] => 191018090000
                        [subType] => PQ
                        [parameterList] => hresfa list
                    )

            )

    )

)
Array
(
[0] => Array
    (
        [bushhh] => Array
            (
                [0] => Array
                    (
                        [date-time] => 19101904591000
                        [sub-type] => PLANNING
                        [comments] => asdf
                        [parameter-list] => list
                        [state] => warning
                        [value] => 203.609375
                        [datetime] => 191019101000
                        [subType] => PLANNING
                        [parameterList] => okk
                    )

            )

    )

[1] => Array
    (
        [busjjasf] => Array
            (
                [0] => Array
                    (
                        [date-time] => 191019045655691000
                        [sub-type] => PLANNING
                        [comments] => dvad  asdf
                        [parameter-list] => sdg
                        [state] => warning
                        [value] => 204.140625
                        [datetime] => 191019101000
                        [subType] => PLANNING
                        [parameterList] => dfg d fgsd
                    )

            )

    )

[2] => Array
    (
        [ asdfa] => Array
            (
                [0] => Array
                    (
                        [date-time] => 1910156111000
                        [sub-type] => PLANNING
                        [comments] => sdfgd afas
                        [parameter-list] => asd fsdf
                        [state] => warning
                        [value] => 204.1875
                        [datetime] => 191019101000
                        [subType] => PLANNING
                        [parameterList] => asdfadfg
                    )

            )

    )

)
Illuminate\Http\JsonResponse Object
(
[data:protected] => {"status":"error","message":"No Record Found"}
[callback:protected] => 
[encodingOptions:protected] => 0
[headers] => Symfony\Component\HttpFoundation\ResponseHeaderBag Object
    (
        [computedCacheControl:protected] => Array
            (
                [no-cache] => 1
                [private] => 1
            )

        [cookies:protected] => Array
            (
            )

        [headerNames:protected] => Array
            (
                [cache-control] => Cache-Control
                [date] => Date
                [content-type] => Content-Type
            )

        [headers:protected] => Array
            (
                [cache-control] => Array
                    (
                        [0] => no-cache, private
                    )

                [date] => Array
                    (
                        [0] => Thu, 18 Jun 2020 10:05:04 GMT
                    )

                [content-type] => Array
                    (
                        [0] => application/json
                    )

            )

        [cacheControl:protected] => Array
            (
            )

    )

[content:protected] => {"status":"error","message":"No Record Found"}
[version:protected] => 1.0
[statusCode:protected] => 404
[statusText:protected] => Not Found
[charset:protected] => 
[original] => Array
    (
        [status] => error
        [message] => No Record Found
    )

[exception] => 
)

I want in Json response where there will only array list. it is in foreach loop.

Thank you



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire