# JSON parse with http monitor

**URL:** <https://community.dynatrace.com/t/json-parse-with-http-monitor/35129>\
**Category:** Synthetic Monitoring\
**Tags:** http-monitor\
**Created:** [May 12, 2022, 1:41pm UTC](https://community.dynatrace.com/t/json-parse-with-http-monitor/35129 "2022-05-12T13:41:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmy](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jimmy](https://community.dynatrace.com/u/jimmy)\
**Post date:** [May 12, 2022, 1:41pm UTC](https://community.dynatrace.com/t/json-parse-with-http-monitor/35129/1 "2022-05-12T13:41:26Z")

</div>

Hello

```auto
I would like to parse a json file with an http monitor this is my json

```

{ “services”: [{ “available”: true, “operation”: “Communes”, “responsecode”: **200** , “service”: “Commune Service” }, { “available”: true, “operation”: “Annexe Groupe”, “responsecode”: **200** , “service”: “Documents Service” }, { “available”: false, “operation”: “Obtenir Disponibilité”, “responsecode”: **500** , “service”: “Utilisateurs Service” }, { “available”: true, “operation”: “Verifier Cheque”, “responsecode”: **200** , “service”: “Platefor” }, { “available”: true, “operation”: “Personne”, “responsecode”: **200** , “service”: “Personne” }, { “available”: true, “operation”: “Recherche”, “responsecode”: **200** , “service”: “Contrat” }] }

I would like to know how I could get the status  
“available”: true,

and make a warning if is set by false

thx for help !

---

<div class="post-metadata">

**Author:** ![hannahmac](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/hannahmac/32/41823_2.png) [@hannahmac](https://community.dynatrace.com/u/hannahmac)\
**Post date:** [May 16, 2022, 8:54am UTC](https://community.dynatrace.com/t/json-parse-with-http-monitor/35129/2 "2022-05-16T08:54:49Z")

</div>

Is it a specific service you are interested in or do you need to know for each service?

---

<div class="post-metadata">

**Author:** ![jimmy](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jimmy](https://community.dynatrace.com/u/jimmy)\
**Post date:** [May 30, 2022, 10:36am UTC](https://community.dynatrace.com/t/json-parse-with-http-monitor/35129/3 "2022-05-30T10:36:36Z")

</div>

Hi thx for answer me !

Is for each service

---

<div class="post-metadata">

**Author:** ![hannahmac](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/hannahmac/32/41823_2.png) [@hannahmac](https://community.dynatrace.com/u/hannahmac)\
**Post date:** [June 6, 2022, 11:30am UTC](https://community.dynatrace.com/t/json-parse-with-http-monitor/35129/4 "2022-06-06T11:30:01Z")

</div>

You can get the response and parse as json like this:

_**var responseBody = response.getResponseBody();**_  
_**var jsonData = JSON.parse(responseBody);**_

You will then need to iterate through each service checking for the status. You can then either use [api.fail()](https://www.dynatrace.com/support/help/how-to-use-dynatrace/synthetic-monitoring/http-monitors/pre-and-post-scripting-for-http-monitors#end) directly to fail the monitor as soon as you find a service that is not available or you can set a variable and then check it once you have checked all the services and then fail the monitor with a message that states which services were not available.
