Eu quero transformar o json em json de nova linha delimitada.
Eu estava tentando fazer isso várias vezes usando o jq no bash, mas eu não consegui chegar nem perto da saída final.
ENTRADA:
{
"windows124": {
"updated": "2015-01-14",
"attribution": [],
"description": "",
"notes": [],
"alt_names": [],
"sources": [],
"urls": ["google.com", "google.co.uk"],
"common_name": "test",
"uuid": "7259334c-3218-4259-aaab-896d87507f4f"
},
"linux124": {
"updated": "",
"attribution": ["Naifdddkoscn"],
"description": "",
"notes": [],
"alt_names": [],
"sources": [],
"urls": ["https://example.com/1.pdf", "https://example.com/1.pdf", "https://example.com/1.pdf"],
"common_name": "121212",
"uuid": "009db412-762d-4256-8df9-eb213be01ffd"
},
"wikipedia123": {
"updated": "2018-07-31",
"attribution": [],
"description": "",
"notes": [],
"alt_names": [],
"sources": [],
"urls": ["https://example.com/1.pdf"],
"common_name": "test343",
"uuid": "4d8da0af-cfd7-4990-b211-af0e990vfda0"
}
}
PRODUZIDO SAÍDA:
{"uuid": "7259334c-3218-4259-aaab-896d87507f4f","family": "windows124","updated": "2015-01-14","attribution": [],"description": "","notes": [],"alt_names": [],"sources": [],"urls": ["google.com", "google.co.uk"],"common_name": "test"}
{"uuid": "009db412-762d-4256-8df9-eb213be01ffd","family": "linux124", "updated": "","attribution": ["Naifdddkoscn"],"description": "","notes": [],"alt_names": [],"sources": [],"urls": ["https://example.com/1.pdf", "https://example.com/1.pdf", "https://example.com/1.pdf"],"common_name": "121212"}
{"uuid": "4d8da0af-cfd7-4990-b211-af0e990vfda0","family": "wikipedia123", "updated": "2018-07-31","attribution": [],"description": "","notes": [],"alt_names": [],"sources": [],"urls": ["https://example.com/1.pdf"],"common_name": "test343"}
O que eu tenho até agora é:
gato deserialize.json | jq -c '. | to_entries []'
{"key":"windows124","value":{"updated":"2015-01-14","attribution":[],"description":"","notes":[],"alt_names":[],"sources":[],"urls":["google.com","google.co.uk"],"common_name":"test","uuid":"7259334c-3218-4259-aaab-896d87507f4f"}}
{"key":"linux124","value":{"updated":"","attribution":["Naifdddkoscn"],"description":"","notes":[],"alt_names":[],"sources":[],"urls":["https://example.com/1.pdf","https://example.com/1.pdf","https://example.com/1.pdf"],"common_name":"121212","uuid":"009db412-762d-4256-8df9-eb213be01ffd"}}
{"key":"wikipedia123","value":{"updated":"2018-07-31","attribution":[],"description":"","notes":[],"alt_names":[],"sources":[],"urls":["https://example.com/1.pdf"],"common_name":"test343","uuid":"4d8da0af-cfd7-4990-b211-af0e990vfda0"}}