Your input appears to be a sequence of Python objects; it certainly is not valid a JSON document.

If you have a list of Python dictionaries, then all you have to do is dump each entry into a file separately, followed by a newline:

import json

with open('output.jsonl', 'w') as outfile:
    for entry in JSON_file:
        json.dump(entry, outfile)
        outfile.write('\n')

The default configuration for the json module is to output JSON without newlines embedded.

Assuming your A, B and C names are really strings, that would produce:

{"index": 1, "met": "1043205", "no": "A"}
{"index": 2, "met": "000031043206", "no": "B"}
{"index": 3, "met": "0031043207", "no": "C"}

If you started with a JSON document containing a list of entries, just parse that document first with json.load()/json.loads().

Answer from Martijn Pieters on Stack Overflow
🌐
Jsonlines
jsonlines.org
JSON Lines
This page describes the JSON Lines text format, also called newline-delimited JSON. JSON Lines is a convenient format for storing structured data that may be processed one record at a time. It works well with unix-style text processing tools and shell pipelines.
🌐
Jsonlines
jsonlines.org › examples
JSON Lines |Examples
CSV seems so easy that many programmers have written code to generate it themselves, and almost every implementation is different. Handling broken CSV files is a common and frustrating task. CSV has no standard encoding, no standard column separator and multiple character escaping standards.
🌐
Snyk
snyk.io › advisor › jsonlines › functions › jsonlines.writer
How to use the jsonlines.Writer function in jsonlines | Snyk
wbolster / jsonlines / tests / test_jsonlines.py View on Github · def test_custom_dumps(): fp = io.BytesIO() writer = jsonlines.Writer(fp, dumps=lambda obj: 'oh hai') with writer: writer.write({}) assert fp.getvalue() == b'oh hai\n'
🌐
PyPI
pypi.org › project › jsonlines
jsonlines · PyPI
Library with helpers for the jsonlines file format
      » pip install jsonlines
    
Published   Sep 01, 2023
Version   4.0.0
🌐
GitHub
github.com › wbolster › jsonlines › blob › master › jsonlines › jsonlines.py
jsonlines/jsonlines/jsonlines.py at master · wbolster/jsonlines
Writer for the jsonlines format. · Instances can be used as a context manager. · The `fp` argument must be a file-like object with a ``.write()`` method accepting either text (unicode) or bytes. · The `compact` argument can be used to to produce smaller output.
Author   wbolster
🌐
Medium
galea.medium.com › how-to-love-jsonl-using-json-line-format-in-your-workflow-b6884f65175b
How to Love jsonl — using JSON Lines in your Workflow | by Alex Galea | Medium
April 9, 2024 - Why you should think about using JSON Line format in your data processing workflow. We’ll look at some jsonl examples and discuss how I…
Find elsewhere
🌐
Snyk
snyk.io › advisor › jsonlines › functions › jsonlines.jsonlines.writer
How to use the jsonlines.jsonlines.Writer function in jsonlines | Snyk
with jsonlines.open('out.jsonl', mode='w') as writer: writer.write(...) :param file-like fp: name of the file to open :param str mode: whether to open the file for reading (``r``), writing (``w``) or appending (``a``).
🌐
Snyk
snyk.io › advisor › jsonlines › jsonlines code examples
Top 5 jsonlines Code Examples | Snyk
wbolster / jsonlines / tests / test_jsonlines.py View on Github · def test_custom_dumps(): fp = io.BytesIO() writer = jsonlines.Writer(fp, dumps=lambda obj: 'oh hai') with writer: writer.write({}) assert fp.getvalue() == b'oh hai\n'
🌐
GitHub
gist.github.com › luminoso › 0581b7f6760ea9a26b06115c2993f351
jsonlines compressed serialization gz write file · GitHub
jsonlines compressed serialization gz write file. GitHub Gist: instantly share code, notes, and snippets.
🌐
GitHub
github.com › jwodder › serde-jsonlines
GitHub - jwodder/serde-jsonlines: Read & write JSON Lines documents
use serde::{Deserialize, Serialize}; use serde_jsonlines::{json_lines, write_json_lines}; use std::io::Result; #[derive(Debug, Deserialize, Eq, PartialEq, Serialize)] pub struct Structure { pub name: String, pub size: i32, pub on: bool, } fn main() -> Result<()> { let values = vec![ Structure { name: "Foo Bar".into(), size: 42, on: true, }, Structure { name: "Quux".into(), size: 23, on: false, }, Structure { name: "Gnusto Cleesh".into(), size: 17, on: true, }, ]; write_json_lines("example.jsonl", &values)?; let values2 = json_lines("example.jsonl")?.collect::<Result<Vec<Structure>>>()?; assert_eq!(values, values2); Ok(()) }
Starred by 33 users
Forked by 4 users
Languages   Rust 100.0% | Rust 100.0%
🌐
GitHub
github.com › wbolster › jsonlines › blob › master › tests › test_jsonlines.py
jsonlines/tests/test_jsonlines.py at master · wbolster/jsonlines
def test_writer_binary() -> None: fp = io.BytesIO() with jsonlines.Writer(fp) as writer: writer.write_all( [ {"a": 1}, {"b": 2}, ] ) assert fp.getvalue() == SAMPLE_BYTES ·
Author   wbolster
🌐
GitHub
github.com › wbolster › jsonlines › blob › master › doc › index.rst
jsonlines/doc/index.rst at master · wbolster/jsonlines
Both readers and writers can be used as a context manager, in which case they will be closed automatically. Note that this will not close a passed-in file-like object since that object’s life span is controlled by the calling code. Example: fp = io.BytesIO() # file-like object with jsonlines.Writer(fp) as writer: writer.write(...) fp.close()
Author   wbolster
🌐
Jsonlines
jsonlines.org › on_the_web
JSON Lines |On The Web
It can process datasets in the ... and recommends JSON lines since long -- it might've even coined the term. serde-jsonlines is a Rust library for reading & writing JSON Lines documents....
🌐
Pathway
pathway.com › developers › api-docs › pathway-io › jsonlines
pw.io.jsonlines | Pathway
The table below explains how the conversion is done. The values of the corresponding types can also be deserialized from JSON back into Pathway values. sourceReads a table from one or several files in jsonlines format.
🌐
GitHub
raw.githubusercontent.com › wbolster › jsonlines › master › jsonlines › jsonlines.py
Githubusercontent
The resulting reader or writer must be closed after use by the caller, which will also close the opened file. This can be done by calling ``.close()``, but the easiest way to ensure proper resource finalisation is to use a ``with`` block (context manager), e.g. :: with jsonlines.open('out.jsonl', mode='w') as writer: writer.write(...) :param file: name or ‘path-like object’ of the file to open :param mode: whether to open the file for reading (``r``), writing (``w``), appending (``a``), or exclusive creation (``x``).
🌐
Rowzero
rowzero.com › blog › open-jsonl-file-format
Easily Open JSONL Files - Guide to JSON Lines Format | Row Zero
import json import jsonlines # Load the JSON file with open('data.json', 'r') as f: data = json.load(f) # Write to a JSONL file with jsonlines.open('data.jsonl', mode='w') as writer: for obj in data: writer.write(obj)