# Bulk API for taking inputs from json file

**URL:** <https://discuss.elastic.co/t/bulk-api-for-taking-inputs-from-json-file/221039>\
**Category:** Elasticsearch\
**Created:** [February 26, 2020, 12:27pm UTC](https://discuss.elastic.co/t/bulk-api-for-taking-inputs-from-json-file/221039 "2020-02-26T12:27:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prajwal\_Bhusari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prajwal_bhusari/32/61515_2.png) [@Prajwal\_Bhusari](https://discuss.elastic.co/u/Prajwal_Bhusari)\
**Post date:** [February 26, 2020, 12:27pm UTC](https://discuss.elastic.co/t/bulk-api-for-taking-inputs-from-json-file/221039/1 "2020-02-26T12:27:28Z")

</div>

How to take a bulk input from json file where each object is terminated by newline.  
I tried -\>  
curl -XPOST [http://localhost:9200/az/doc/\_bulk](http://localhost:9200/az/doc/_bulk) -H "Content-Type: application/json" -d @test.json

my test.json looks like - {  
"name":"John",  
"age":30,  
"cars":["Ford", "BMW", "Fiat"]  
}  
{  
"name":"John1",  
"age":33,  
"cars":["Ford", "BMW", "Fiat"]  
}

az is index.  
it's giving error -\> {"error":{"root\_cause":[{"type":"illegal\_argument\_exception","reason":"The bulk request must be terminated by a newline [\n]"}],"type":"illegal\_argument\_exception","reason":"The bulk request must be terminated by a newline [\n]"},"status":400}

What should be the correct way to do this?  
Please help!

---

<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:** [March 25, 2020, 12:27pm UTC](https://discuss.elastic.co/t/bulk-api-for-taking-inputs-from-json-file/221039/2 "2020-03-25T12:27:30Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
