I have JSON exported from Cassandra in this format.
[
{
"correlationId": "2232845a8556cd3219e46ab8",
"leg": 0,
"tag": "received",
"offset": 263128,
"len": 30,
"prev": {
"page": {
"file": 0,
"page": 0
},
"record": 0
},
"data": "HEAD /healthcheck HTTP/1.1
"
},
{
"correlationId": "2232845a8556cd3219e46ab8",
"leg": 0,
"tag": "sent",
"offset": 262971,
"len": 157,
"prev": {
"page": {
"file": 10330,
"page": 6
},
"record": 1271
},
"data": "HTTP/1.1 200 OK
Date: Wed, 14 Feb 2018 12:57:06 GMT
Server:
Connection: close
X-CorrelationID: Id-2232845a8556cd3219e46ab8 0
Content-Type: text/xml
"
}]
I would like to split it to separate documents:
{
"correlationId": "2232845a8556cd3219e46ab8",
"leg": 0,
"tag": "received",
"offset": 263128,
"len": 30,
"prev": {
"page": {
"file": 0,
"page": 0
},
"record": 0
},
"data": "HEAD /healthcheck HTTP/1.1
"
}
and
{
"correlationId": "2232845a8556cd3219e46ab8",
"leg": 0,
"tag": "sent",
"offset": 262971,
"len": 157,
"prev": {
"page": {
"file": 10330,
"page": 6
},
"record": 1271
},
"data": "HTTP/1.1 200 OK
Date: Wed, 14 Feb 2018 12:57:06 GMT
Server:
Connection: close
X-CorrelationID:
Id-2232845a8556cd3219e46ab8 0
Content-Type: text/xml
"
}
I wanted to use jq but didn't find way how.
Can you please advise way, how to split it by the document separator?
Thanks, Reddy
See Question&Answers more detail:
os