# Parse json files

**URL:** <https://discuss.elastic.co/t/parse-json-files/32647>\
**Category:** Elasticsearch\
**Created:** [October 21, 2015, 8:03am UTC](https://discuss.elastic.co/t/parse-json-files/32647 "2015-10-21T08:03:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![deseint](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@deseint](https://discuss.elastic.co/u/deseint)\
**Post date:** [October 21, 2015, 8:03am UTC](https://discuss.elastic.co/t/parse-json-files/32647/1 "2015-10-21T08:03:20Z")

</div>

Hello,  
I would like to parse a JSON file with ElasticSearch.  
In which directory must I put this file ?

Because when I execute this command:  
POST /eurogiciel/test/ --data-binary @test.json  
or  
POST /eurogiciel/test/ -d @test.json

In my SENSE dashboard,I've got this error message :  
{"error": "MapperParsingException[failed to parse]; nested:  
ElasticsearchParseException[Failed to derive xcontent]; ",  
"status": 400}

NB: my test.json file contains :  
{"title": "billy","amount": 5.7}

Thanks a lot for your help.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 21, 2015, 12:07pm UTC](https://discuss.elastic.co/t/parse-json-files/32647/2 "2015-10-21T12:07:49Z")

</div>

Don't use SENSE in that case. Use CURL for example

---

<div class="post-metadata">

**Author:** ![deseint](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@deseint](https://discuss.elastic.co/u/deseint)\
**Post date:** [October 21, 2015, 12:21pm UTC](https://discuss.elastic.co/t/parse-json-files/32647/3 "2015-10-21T12:21:31Z")

</div>

Thank you for answer

But even else where, my curl command doesn't work as I described the error message.  
So my question is : where am I supposed to put the files I want to import into ElasticSearch ?  
Is the data directory (C:\Program Files (x86)\elasticsearch-1.7.2\data) expected to store this files ?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 21, 2015, 12:39pm UTC](https://discuss.elastic.co/t/parse-json-files/32647/4 "2015-10-21T12:39:59Z")

</div>

It's not a question related to elasticsearch here but to CURL.  
Here CURL under windows.

I'd read the documentation about curl.  
I can't answer myself as I don't use this under windows ( and I have a limited usage of curl).

BTW what do you want to achieve? Is it that you want to run that in production?

I mean that with curl you can directly send the json content without needing a file for this.

Answering to your question: you can store your file wherever you want.

---

<div class="post-metadata">

**Author:** ![deseint](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@deseint](https://discuss.elastic.co/u/deseint)\
**Post date:** [October 21, 2015, 12:47pm UTC](https://discuss.elastic.co/t/parse-json-files/32647/5 "2015-10-21T12:47:40Z")

</div>

Ok I would like to put my json files in this directory:  
C:\Program Files (x86)\elasticsearch-1.7.2\data\*.json

This files are supposed to contain big data encoded in base64...(but for the moment I'm just making tests with a file.json very simple)

How ElasticSearch knows where are this files ? Because the curl command doesn't specify the path I mean...strange no ?

---

<div class="post-metadata">

**Author:** ![Camilo\_Sierra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/camilo_sierra/32/14397_2.png) [@Camilo\_Sierra](https://discuss.elastic.co/u/Camilo_Sierra)\
**Post date:** [October 21, 2015, 12:54pm UTC](https://discuss.elastic.co/t/parse-json-files/32647/6 "2015-10-21T12:54:12Z")

</div>

when you use a curl function curl -XPOST '[http://jfblouvmlxecs01:9200/test/test/1](http://jfblouvmlxecs01:9200/test/test/1)' -d @lane.json \> that means that jane.json is in the current file where you made your curl ! but how says @dadoonet this is not about ES but about how execute commands !

1. go to C:\Program Files (x86)\elasticsearch-1.7.2\ (your json is hear, ex : test.json)
2. stay in the same path, and execute your curl \> curl -XPOST '[http://jfblouvmlxecs01:9200/test/test/1](http://jfblouvmlxecs01:9200/test/test/1)' -d @test.json

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 21, 2015, 1:11pm UTC](https://discuss.elastic.co/t/parse-json-files/32647/7 "2015-10-21T13:11:13Z")

</div>

But please don't put any file in elasticsearch data dir.  
Put your files in whatever dir you want but not there.

---

<div class="post-metadata">

**Author:** ![deseint](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@deseint](https://discuss.elastic.co/u/deseint)\
**Post date:** [October 21, 2015, 1:38pm UTC](https://discuss.elastic.co/t/parse-json-files/32647/8 "2015-10-21T13:38:27Z")

</div>

Ok I understand.  
I executed my command curl via windows console like this :  
C:\Program Files (x86)\elasticsearch-1.7.2\data\>curl -XPOST '[http://localhost:9200/eurogiciel/cv/1](http://localhost:9200/eurogiciel/cv/1)' -d @test.json  
but this message error appears:  
'curl' is not a command...

So I've download curl.exe with GOW (version Gow-0.7.0.exe)  
And my command curl did work !!  
Thank you very much 😄

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:43pm UTC](https://discuss.elastic.co/t/parse-json-files/32647/9 "2017-07-05T23:43:33Z")

</div>


