# Ratel doesn't accept mutations in JSON format

**URL:** <https://discuss.dgraph.io/t/ratel-doesnt-accept-mutations-in-json-format/8061>\
**Category:** Ratel\
**Tags:** status:accepted, kind:bug, ratel\
**Created:** [June 30, 2020, 7:20am UTC](https://discuss.dgraph.io/t/ratel-doesnt-accept-mutations-in-json-format/8061 "2020-06-30T07:20:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [June 30, 2020, 7:20am UTC](https://discuss.dgraph.io/t/ratel-doesnt-accept-mutations-in-json-format/8061/1 "2020-06-30T07:20:03Z")

</div>

**Moved from GitHub [ratel/220](https://github.com/dgraph-io/ratel/issues/220)**

_Posted by_ [danielmai](https://github.com/danielmai):

### Steps to reproduce

I’m trying to send the following mutation in Ratel:

```auto
{"set":[{"uid":"_:root","connects":[{"name": "A"},{"name":"B"}]]}

```

I get the following error, when I expect it to succeed:

```auto
{
  "name": "t",
  "url": "http://localhost:8080/mutate?commitNow=true",
  "errors": [
    {
      "message": "while lexing {\"set\":[{\"uid\":\"_:root\",\"connects\":[{\"name\": \"A\"},{\"name\":\"B\"}]]} at line 1 column 1: Unrecognized character inside mutation: U+0022 '\"'",
      "extensions": {
        "code": "ErrorInvalidRequest"
      }
    }
  ]
}

```

This error message is telling me that the mutation was processed as an RDF mutation when it should’ve processed it as a JSON mutation. In the network inspector, I see it sent the mutation request with the `Content-Type` header as `application/rdf` instead of `application/json`.

### Additional info

Ratel info from the Latest distribution

```auto
Built at 2020-06-17T15:16:21.698Z
Commit: 2cdc64b
Commit Info: 2cdc64b Wed Jun 17 18:15:46 2020 +0300 (HEAD -> master)

```

Dgraph version v20.03.3.

---

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [June 30, 2020, 9:36am UTC](https://discuss.dgraph.io/t/ratel-doesnt-accept-mutations-in-json-format/8061/2 "2020-06-30T09:36:30Z")

</div>

[paulftw](https://github.com/paulftw) _commented_ :

This is happening because query doesn’t parse as JSON so it’s sent as RDF.  
If Ratel sent it as JSON there’d be a different though more relevant syntax error returned.

Correct JSON:

```auto
{"set":[{"uid":"_:root","connects":[{"name": "A"},{"name":"B"}]}]}

```

Incorrect JSON:

```auto
{"set":[{"uid":"_:root","connects":[{"name": "A"},{"name":"B"}]]}

```

Note one more curly closing bracket in the end of the correct query.

 ![Screen Shot 2020-06-30 at 12 28 06 PM](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/c/cf807e83006ccf258a16b5a7302284f7f8677128.png)

I’m closing this issue as working as expected and will file a feature request to provide a visual indication of the detected content-type.

---

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [July 11, 2020, 3:24am UTC](https://discuss.dgraph.io/t/ratel-doesnt-accept-mutations-in-json-format/8061/3 "2020-07-11T03:24:12Z")

</div>


