I am having some requirements:
- Each json data point must be on a single line
- Each json data point must be separated by a newline character
- Additionally, if possible each data point must be separated by an {"index":{}} statement
I am having roughly 1000 json data points. Here is an example of what three look like:
{
"str field": "some string",
"int field": 12345,
"bool field": True
}{
"str field": "another string",
"int field": 42,
"bool field": False
}{
"str field": "random string",
"int field": 3856452,
"bool field": True
}
But I need it to look like so:
{"index":{}}
{"str field": "some string", "int field": 12345, "bool field": True}
{"index":{}}
{"str field": "another string", "int field": 42, "bool field": False}
{"index":{}}
{"str field": "random string", "int field": 3856452, "bool field": True}
Currently i am using http://jsonviewer.stack.hu/ along with notepad++ to accomplish this but it is not always working properly and struggles with larger datasets. I would prefer not to use a third party website but rather accomplish the same using an IDE such as VS Code or IntelliJ.
If you are familiar with elasticsearch I am essentially formatting the data for bulk indexing operations.
Thank you