# Convert XML output to json collection in Laravel 5.4

**URL:** <https://community.wowza.com/t/convert-xml-output-to-json-collection-in-laravel-5-4/49564>\
**Category:** Wowza Developer Dojo\
**Created:** [August 29, 2017, 2:12pm UTC](https://community.wowza.com/t/convert-xml-output-to-json-collection-in-laravel-5-4/49564 "2017-08-29T14:12:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eddie\_Elzinga](https://avatars.discourse-cdn.com/v4/letter/e/97f17d/32.png) [@Eddie\_Elzinga](https://community.wowza.com/u/Eddie_Elzinga)\
**Post date:** [August 29, 2017, 2:12pm UTC](https://community.wowza.com/t/convert-xml-output-to-json-collection-in-laravel-5-4/49564/1 "2017-08-29T14:12:41Z")

</div>

Hello …

I want to know how I can convert the cURL API XML response to JSON so I can use a foreach loop within my blade page(s).

I use a controller method and do a dd (diedump) on the cURL query. This is the result:

\<?xml version="1.0" encoding="UTF-8" ?\>\n

```auto
<PushPublishStreams serverName="_defaultServer_">\n
  <Version>1502953623962</Version>\n
  <MapEntries>\n
    <EntryName>Leeuwarden</EntryName>\n
    <SessionStatus>NotFound</SessionStatus>\n

etc ..<br><br>Hope someone has experience with this in Laravel and is willing to explain me how to achieve this. All I need for now is the SessionStatus.

Thanks in advance

```

---

<div class="post-metadata">

**Author:** ![6f069d62f51916ca52a1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/6f069d62f51916ca52a1/32/1370_2.png) [@6f069d62f51916ca52a1](https://community.wowza.com/u/6f069d62f51916ca52a1)\
**Post date:** [December 28, 2023, 7:17pm UTC](https://community.wowza.com/t/convert-xml-output-to-json-collection-in-laravel-5-4/49564/2 "2023-12-28T19:17:53Z")

</div>

Hello @Eddie_Elzinga, you can able to receive the json using the Header `Accept:application/json`, at the common laravel request, something like this:

```auto
Http::accept('application/json')->get('http://wonza:8879/v2/server/...');

```

There a documentation about the Http Client with headers, but I can’t post the link due to limitation of this forum
