Questions tagged [jsonlines]

JSON Lines is a format for storing structured data that may be processed one record at a time. It 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.

This text format is documented at http://jsonlines.org/.

156 questions
5
votes
1 answer

How to define a json-lines response in OpenAPI?

Is there a way to describe a json-lines with OpenAPI? Besides the fact that there seems to be no MIME type for it yet, I'm wondering if it's possible to describe such a response. In theory my response could be an array of objects, but I received the…
Skeeve
  • 7,188
  • 2
  • 16
  • 26
5
votes
2 answers

Convert sequence of JSON lines (JSONL) to JSON array

I have a file where each line is a JSON object. I'd like to convert the file to a JSON array. The file looks something like this: {"address":"email1@foo.bar.com", "topic":"Some topic."} {"address":"email2@foo.bar.com", "topic":"Another…
km1
  • 2,383
  • 1
  • 22
  • 27
4
votes
3 answers

Converting comma delimited JSON to a newline delimited node

I have a JSON file which I am reading with node, modifying and saving it as a json file. I'm looking to save the new json as newline delimited vs being in an array. I came across https://github.com/CrowdProcess/newline-json but don't fully…
kisonay
  • 351
  • 2
  • 7
  • 15
3
votes
1 answer

How to return chunked text/plain content from Web API using minimal API

Using an ASP.NET Core 6 Web API written in C# with minimal API, I would like to return a stream of data without first loading the data into memory. In my case this is JSONL (JSON lines) data that is written by Apache Spark. JSONL is a text-based…
Morrolan
  • 317
  • 3
  • 10
3
votes
1 answer

struggling to parse an object using jsonlines

I'm having trouble parsing the body of a request using jsonlines. I'm using tornado as the server and this is happening inside a post() method. My purpose in this is to parse the request's body into separate JSONs, then iterate over them with a…
Oren_C
  • 565
  • 7
  • 22
3
votes
1 answer

A file that contains many JSON, what is the definition of such file?

I have a file that contains many dictionaries, each line with its own unique dictionary and there are many lines in this file. {"text": "bla bla", "year": 1933, "price": 43} {"text": "bla blu", "year": 1934, "price": 41} {"text": "blu bla", "year":…
Lior Magen
  • 1,533
  • 2
  • 15
  • 33
3
votes
1 answer

jq '.' formatted json file back to original json format using jq

Here is my json: [ { "ReferringUrl": "N", "OpenAccess": "0", "ItmId": "1694738780" }, { "ReferringUrl": "L", "OpenAccess": "1", "ItmId": "1347809133" } ] I want it back to the original json format: [{"ReferringUrl":…
Eleanor
  • 2,647
  • 5
  • 18
  • 30
2
votes
2 answers

How to read JSONL line-by-line after hitting url in Node.JS?

From the Shopify API, I receive a link to a large amount of JSONL. Using NodeJS, I need to read this data line-by-line, as loading it all at once would use lots of memory. When I hit the JSONL url from the web browser, it automatically downloads the…
Danny Adams
  • 143
  • 1
  • 8
2
votes
1 answer

Matching label with sentence in json format

I have a huge list of dictionaries with data labeled as follows {'id': 2, 'text': '"The hotel has many restaurants to enjoy a meal. My husband and I went to the Japanese restaurant and we only found sushi. Considering that it is an international…
2
votes
1 answer

Unable to load jsonl nested file into a flattened dataframe

I have been trying this for 2 days now, to load this jsonl nested file into a dataframe but unable to succeed. I want to load this into a flattened data frame as I want to perform some join and aggregations after inserting into a database. pasting…
2
votes
4 answers

Read nested JSON into Dask DataFrame

I am trying to read nested JSON into a Dask DataFrame, preferably with code that'll do the heavy lifting. Here's the JSON file I am reading: { "data": [{ "name": "george", "age": 16, "exams": [{ "subject":…
Powers
  • 18,150
  • 10
  • 103
  • 108
2
votes
2 answers

Java conversion from list to JSONL

I'd like to convert a list of objects to JSONL where each object in the list will be a line in the json. e:g: Let's say I have a list of Person and I want to convert that list to a separate file in the JSONL format List personList =…
2
votes
1 answer

Parse and write JSON Lines format file

I have a file in JSON Lines format with the following content: [1, "James", 21, "M", "2016-04-07 10:25:09"] [2, "Liz", 25, "F", "2017-05-07 20:25:09"] ... Each line is a JSON array string, and the types of fields are:…
2
votes
1 answer

jq filter for object with target value or key is not exist

I have jsonlines data which and would like to find 1. value is empty object or 2. key is not exist . In the following sample, I wonder take the result of items which .items.spec.resource={} or .items.spec.limits|requests which key not…
Makkenac
  • 33
  • 5
2
votes
1 answer

Json lines (Jsonl) generator to csv format

I have a large Jsonl file (6GB+) which I need to convert to .csv format. After running: import json with open(root_dir + 'filename.json') as json_file: for line in json_file: data = json.loads(line) print(data) Many records of the below…
DJW001
  • 143
  • 2
  • 10
1
2
3
10 11