# JSON file mutation + query help

**URL:** <https://discuss.dgraph.io/t/json-file-mutation-query-help/9594>\
**Category:** Dgraph\
**Tags:** dataset, kind:question, area:live-loader\
**Created:** [August 21, 2020, 12:27am UTC](https://discuss.dgraph.io/t/json-file-mutation-query-help/9594 "2020-08-21T00:27:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wood](https://avatars.discourse-cdn.com/v4/letter/w/7993a0/32.png) [@wood](https://discuss.dgraph.io/u/wood)\
**Post date:** [August 21, 2020, 12:27am UTC](https://discuss.dgraph.io/t/json-file-mutation-query-help/9594/1 "2020-08-21T00:27:00Z")

</div>

Hey guys,

I got all data converted from CSV format to JSON format and I tried to begin loading. When i use this command, it seems like nothing works:  
`curl -H "Content-Type: application/rdf" "localhost:8080/mutate?commitNow=true" -XPOST --data-binary @jsonfile.json`  
But if i copy-paste a portion of the file into ratel and run it as a mutation on there, it works fine???

Here is a sample object in the file:

```auto
{
  "set": [
    {
      "Commentid": 1236950581249,
      "creationDate": "2011-08-17T14:26:59.961+0000",
      "locationIP": "92.39.58.88",
      "browserUsed": "Chrome",
      "content": "yes",
      "length": 3,
      "dgraph.type": "Comment"
    },

```

After I successfully mutate the graph using ratel, I’m unable to even query for the data points I just created. I’ve tried adding a Comment type and querying for all Comment types, and also querying for has “Commentid”, which should have been loaded since I was returned with a success message.

Query is simple enough:

```auto
{
  q(func: type(Comment) {
		expand(_all_)
  }
}

```

TLDR; 1. Am i loading the json files correctly?  
2. Is creating types a must?

Thanks,  
Kevin

---

<div class="post-metadata">

**Author:** ![chewxy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/chewxy/32/4339_2.png) [@chewxy](https://discuss.dgraph.io/u/chewxy)\
**Post date:** [August 21, 2020, 1:00am UTC](https://discuss.dgraph.io/t/json-file-mutation-query-help/9594/2 "2020-08-21T01:00:19Z")

</div>

I don’t think it’s adding a type at all. If you look at your Schemas , then click Type in Ratel, you will find that `Comment` was not added.

---

<div class="post-metadata">

**Author:** ![wood](https://avatars.discourse-cdn.com/v4/letter/w/7993a0/32.png) [@wood](https://discuss.dgraph.io/u/wood)\
**Post date:** [August 21, 2020, 1:17am UTC](https://discuss.dgraph.io/t/json-file-mutation-query-help/9594/3 "2020-08-21T01:17:29Z")

</div>

Yeah, it’s not adding it a type.

If i add the type manually myself, I still cannot query for it ☹

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [August 21, 2020, 1:59am UTC](https://discuss.dgraph.io/t/json-file-mutation-query-help/9594/4 "2020-08-21T01:59:29Z")

</div>

> [@wood](#):
>
> “Content-Type: application/rdf”

Why this is set RDF when you are sending JSON?

BTW, You have to add Type Definition on the Schema itself, not wait that Dgraph would infer your data and create the Type Def for you.

To be able to use expand All and Delete, you have to have a well-defined Schema Type along with the “dgraph.type” on your dataset.

Cheers.
