# Resolving JSON Parse Error in Label Studio API Call

**URL:** <https://community.labelstud.io/t/resolving-json-parse-error-in-label-studio-api-call/171>\
**Category:** Label Studio Support\
**Tags:** formatting, json, api\
**Created:** [May 10, 2024, 6:32pm UTC](https://community.labelstud.io/t/resolving-json-parse-error-in-label-studio-api-call/171 "2024-05-10T18:32:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sajarin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/sajarin/32/56_2.png) [@sajarin](https://community.labelstud.io/u/sajarin)\
**Post date:** [May 10, 2024, 6:32pm UTC](https://community.labelstud.io/t/resolving-json-parse-error-in-label-studio-api-call/171/1 "2024-05-10T18:32:19Z")

</div>

#### Question

> When attempting to add a label configuration through the Label Studio API, I receive an error even though the config works fine in the UI. What is the mistake in the following cURL command I’m using to add the label config via API?

```auto
!curl -X POST http://<omitted for security>:8080/api/projects/validate/ \
-H 'Authorization: Token <Omitted for security> ' \
-H 'Content-Type: application/json' \
-d '{"label_config": "<View><Header value="Listen to the audio:"/><Audio name="audio" value="$url"/><Text name="txt0" value="Is the word given below intelligible in the above audio ?"></Text><Text name="txt" value="$word"></Text><Text name="sentence" value="$text"></Text><Choices name="intelligibility" toName="audio" choice="single-radio" showInline="true"><Choice value="Yes"/><Choice value="No"/></Choices></View>"}'

```

#### Answer

The issue with the provided cURL command is due to JSON parsing errors arising from unescaped double quotes within the `label_config` JSON property. To fix this, you need to use escaped double quotes (`\"`) for HTML attribute values inside the JSON string or alternatively use single quotes (`'`) for non-JSON strings. Here’s the corrected cURL command with the double quotes escaped:

shell

```auto
curl -X POST http://<omitted for security>:8080/api/projects/validate/ \
-H 'Authorization: Token <omitted for security>' \
-H 'Content-Type: application/json' \
-d '{"label_config": "<View><Header value=\"Listen to the audio:\"/><Audio name=\"audio\" value=\"$url\"/><Text name=\"txt0\" value=\"Is the word given below intelligible in the above audio ?\"></Text><Text name=\"txt\" value=\"$word\"></Text><Text name=\"sentence\" value=\"$text\"></Text><Choices name=\"intelligibility\" toName=\"audio\" choice=\"single-radio\" showInline=\"true\"><Choice value=\"Yes\"/><Choice value=\"No\"/></Choices></View>"}'

```

Ensure all the double quotes around HTML attributes in the `label_config` value are properly escaped.
