# Posting json format data using Robot Framework

**URL:** <https://forum.robotframework.org/t/posting-json-format-data-using-robot-framework/932>\
**Category:** Robot Framework\
**Created:** [5 November 2020 15:58 UTC](https://forum.robotframework.org/t/posting-json-format-data-using-robot-framework/932 "2020-11-05T15:58:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beau-Sof](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@Beau-Sof](https://forum.robotframework.org/u/Beau-Sof)\
**Post date:** [5 November 2020 15:58 UTC](https://forum.robotframework.org/t/posting-json-format-data-using-robot-framework/932/1 "2020-11-05T15:58:57Z")

</div>

I am attempting to post to my API using robot framework Here is my code:

```python
***Variables***
${FW_API} "API SERVER"
${uri} "API REPOSITORY"
${json_String}= {"FileName": "\\\\PATH", "ClientCode": "Attachments", "Template": "$::Attachments"}

***Test Cases***
FW_API_Post_Request
    Create Session Framework_API ${FW_API}
    Sleep 1s
    #${body}= Create dictionary ${json_String}
    ${header}= Create dictionary Content-Type=application/json
    ${response}= Post Request alias=Framework_API uri=${uri} headers=${header} data=${json_String}
    Sleep 1s
    log to console ${Response.status_code}
    log to console ${Response.content}
    Sleep 3s

    #VALIDATIONS

    ${res_body}= convert to string ${response.content}

```

When looking within my log, The body shows:

```python
 body="{\"FileName\": \"PATH\", \"ClientCode\": \"Attachments\", \"Template\": "$::Attachments\"}" 

```

I have no clue why the additional escapes are showing up I can only assume the data is not being translated properly. I have done quite a few searches and all I have seen states I am coding this correctly. I may need to convert to JSON. But I tried that as well. Same result (400 error) due to invalid submitted data. Any assistance is greatly appreciated

Thanks

---

<div class="post-metadata">

**Author:** ![Noordsestern](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/noordsestern/32/4270_2.png) [@Noordsestern](https://forum.robotframework.org/u/Noordsestern)\
**Post date:** [5 November 2020 17:29 UTC](https://forum.robotframework.org/t/posting-json-format-data-using-robot-framework/932/2 "2020-11-05T17:29:54Z")

</div>

The additional escapes are correct. I wonder about the last element though: `$:: Attachment` misses an escape.

The escapes are necessary, because `response.content` is a string containing the json.

If you want json as dictionary you need:

```python
${body} Evaluate json.loads($response.content}

```
