Your second example is not valid json. It is jsonl:

JSONL is a text-based format that uses the .jsonl file extension and is essentially the same as JSON format except that newline characters are used to delimit JSON data. It also goes by the name JSON Lines.

To deal with files like this you can read in each line as json, and then rbind() the results. A base R approach (requires at least R 4.2 for the _ placeholder):

library(jsonlite)
json_text <- readLines("tech.json", warn = FALSE, encoding = "UTF-8")

lapply(json_text, fromJSON) |>
    do.call(rbind, args = _) |>
    data.frame()

#   id   name  color price
# 1  1  Apple    red  0.99
# 2  2 Banana yellow   0.5
# 3  3 Orange orange  0.75

Alternatively, here's a dplyr approach:

library(dplyr)
lapply(json_text, fromJSON) |>
    bind_rows()

# # A tibble: 3 x 4
#      id name   color  price
#   <int> <chr>  <chr>  <dbl>
# 1     1 Apple  red     0.99
# 2     2 Banana yellow  0.5 
# 3     3 Orange orange  0.75

And for the sake of completeness here's the data.table way to do the same:

library(data.table)
lapply(json_text, fromJSON) |>
    rbindlist()
#       id   name  color price
#    <int> <char> <char> <num>
# 1:     1  Apple    red  0.99
# 2:     2 Banana yellow  0.50
# 3:     3 Orange orange  0.75
Answer from SamR on Stack Overflow
๐ŸŒ
Jsonlines
jsonlines.org โ€บ examples
JSON Lines |Examples
JSON Lines enables applications to read objects line-by-line, with each line fully describing a JSON object. The example above contains the same data as the tabular example above, but allows applications to split files on newline boundaries for parallel loading, and eliminates any ambiguity ...
๐ŸŒ
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.
๐ŸŒ
ServiceStack
docs.servicestack.net โ€บ jsonl-format
JSON Lines Data Format
In this example, we will walk you through a practical demonstration of using JSON Lines to index AI-generated art albums. We will fetch data from the Blazor Diffusion API, which provides "Creatives" generated based on user-provided text prompts.
๐ŸŒ
Jsonltools
jsonltools.com โ€บ what-is-jsonl
What is JSONL? An Introduction to JSON Lines Format - JSONL Tools
Learn what JSONL (JSON Lines) is, how it works, and why developers use it. JSON Lines is a convenient format for storing structured data that may be processed one record at a time. Complete guide with examples, use cases, and comparison to JSON. Start working with JSONL today.
๐ŸŒ
Medium
medium.com โ€บ @sujathamudadla1213 โ€บ difference-between-ordinary-json-and-json-lines-fc746f93d75e
Difference between ordinary json and json lines? | by Sujatha Mudadla | Medium
October 23, 2023 - Format: JSON is a text-based data interchange format. Structure: It represents data as key-value pairs and supports various data types, including objects, arrays, strings, numbers, booleans, and null. ... Usage: Typically used for configuration files, data exchange between a server and a web application, and various other scenarios where structured data needs to be transmitted. ... Format: Each line in a JSON Lines file is a valid JSON object, and the objects are separated by newline characters.
๐ŸŒ
Medium
nicholaszhan.com โ€บ line-em-up-a-guide-to-json-lines-7c43215b3b82
Line โ€™Em Up: A Guide to JSON Lines | by Nicholas Zhan | Medium
February 2, 2024 - To illustrate the usefulness and simplicity of JSON Lines, letโ€™s create and handle a small dataset. Weโ€™ll use the context of a hypothetical app that collects sensor data from various devices.Imagine weโ€™re collecting temperature and humidity data from different locations.
๐ŸŒ
JSON for Modern C++
json.nlohmann.me โ€บ features โ€บ parsing โ€บ json_lines
JSON Lines - JSON for Modern C++
#include <sstream> #include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { // JSON Lines (see https://jsonlines.org) std::stringstream input; input << R"({"name": "Gilbert", "wins": [["straight", "7โ™ฃ"], ["one pair", "10โ™ฅ"]]} {"name": "Alexa", "wins": [["two pair", "4โ™ "], ["two pair", "9โ™ "]]} {"name": "May", "wins": []} {"name": "Deloise", "wins": [["three of a kind", "5โ™ฃ"]]} )"; std::string line; while (std::getline(input, line)) { std::cout << json::parse(line) << std::endl; } }
Find elsewhere
๐ŸŒ
Readthedocs
jsonlines.readthedocs.io
jsonlines โ€” jsonlines documentation - Read the Docs
The sort_keys argument can be used to sort keys in json objects, and will produce deterministic output. For more control, provide a a custom encoder callable using the dumps argument. The callable must produce (unicode) string output. If specified, the compact and sort arguments will be ignored. When the flush argument is set to True, the writer will call fp.flush() after each written line...
๐ŸŒ
GitHub
github.com โ€บ raphaelstolt โ€บ json-lines
GitHub - raphaelstolt/json-lines: Library for the JSON Lines text file format.
This is a library to enline to the JSON Lines format and to deline back from it to JSON.
Starred by 39 users
Forked by 6 users
Languages ย  PHP 100.0% | PHP 100.0%
๐ŸŒ
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
March 5, 2022 - Itโ€™s a file type specification where each line is a JSON object. Just imagine a bunch of stacked up dictionaries. Hereโ€™s an example with 4 records:
๐ŸŒ
Jsonlines
jsonlines.org โ€บ on_the_web
JSON Lines |On The Web
April 26, 2019 - The top view can load Terabyte+ JSON Lines files, the bottom view's JSON editor contains the selected JSON lines item, with syntax highlighting, schema aware validation, auto complete/intellisense, and other tools.
๐ŸŒ
Datafix
datafix.com.au โ€บ BASHing โ€บ 2020-01-29.html
JSON Lines: record-style JSON - Data auditing and cleaning
January 7, 2023 - The JSON Lines is on three lines, one for each date. Each of those lines is in UTF-8 encoding, ends with a linefeed character and is valid JSON. Those are the only three requirements for the JSON Lines format. The fire-ban-by-date example shows that JSON Lines is a neat format for data logs.
๐ŸŒ
HackerNoon
hackernoon.com โ€บ json-lines-format-76353b4e588d
JSON Lines format: Why jsonl is better than a regular JSON for web scraping | HackerNoon
January 3, 2026 - Comma Separated Values (CSV) format is a common data exchange format used widely for representing sets of records with identical list of fields.
๐ŸŒ
Rowzero
rowzero.com โ€บ blog โ€บ open-jsonl-file-format
Easily Open JSONL Files - Guide to JSON Lines Format - Row Zero โ€“ the spreadsheet for modern cloud data
October 24, 2024 - import csv import json # Function to convert CSV to JSONL def csv_to_jsonl(csv_file, jsonl_file): # Open the CSV file with open(csv_file, mode='r', encoding='utf-8') as csv_f: reader = csv.DictReader(csv_f) # Automatically use the header row as field names # Open the JSONL file with open(jsonl_file, mode='w', encoding='utf-8') as jsonl_f: for row in reader: jsonl_f.write(json.dumps(row) + '\n') # Write each row as a JSON object followed by a newline # Example usage: csv_to_jsonl('input.csv', 'output.jsonl') # What is a JSONL file? JSONL, short for JSON Lines, is a file format where each line represents a valid JSON object.
๐ŸŒ
Dbconvert
streams.dbconvert.com โ€บ blog โ€บ json-lines-data-stream
JSON Lines format is what you need for data streams.
April 22, 2025 - In order to insert or read a record from a JSON array you have to parse the whole file, which is far from ideal. Since every entry in JSON Lines is a valid JSON it can be parsed/unmarshaled as a standalone JSON document. For example, you can seek within it, split a 10gb file into smaller files without parsing the entire thing.
๐ŸŒ
NCBI
ncbi.nlm.nih.gov โ€บ datasets โ€บ docs โ€บ v2 โ€บ tutorials โ€บ working-with-jsonl-data-reports
Working with JSON Lines data reports - NCBI - NIH
December 4, 2021 - After downloading and unzipping a gene data package, use grep to pull out the line matching the desired gene symbol. The result remains in the form of valid JSON Lines and may be viewed in tabular form via dataformat, or rendered as JSON using jq to pretty-print (and head to show the first 10 lines, as in the example below).
๐ŸŒ
Wikipedia
en.wikipedia.org โ€บ wiki โ€บ JSON_streaming
JSON streaming - Wikipedia
1 week ago - In addition, it is suggested that each JSON text sequence be followed by a line feed character to allow proper handling of top-level JSON objects that are not self delimiting (numbers, true, false, and null). This format is also known as JSON Text Sequences or MIME type application/json-seq, and is formally described in IETF RFC 7464. The example below shows two JSON objects with โž representing the record separator control character and โŠ representing the line feed character:
๐ŸŒ
GitHub
github.com โ€บ jsonlines โ€บ guide
GitHub - jsonlines/guide: Tutorial on streaming JSON data analysis on the command line
April 23, 2025 - The jsonfilter command takes in a stream of JSON Lines and based on a filter expression exports a subset of data out as JSON Lines. For example purposes this repository contains the metadata for 100 Data.gov datasets in JSON Lines format.
Starred by 95 users
Forked by 4 users
๐ŸŒ
DEV Community
dev.to โ€บ scrapfly_dev โ€บ jsonl-vs-json-hb0
JSONL vs JSON - DEV Community
December 17, 2024 - Example Use Case: In a web scraping session that runs for hours, new data points can be appended to the JSONLines file on the fly, ensuring uninterrupted storage and minimal memory usage. Scrapy, one of the most popular frameworks for web scraping, natively supports JSONLines as a default output format for exporting scraped data. Hereโ€™s why JSONLines works so well with Scrapy: Automatic Handling: Scrapy writes each scraped item as a new line ...