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
2
votes
1 answer

Why does jsonlines package get resolved to registry.npm.taobao.org?

When I install the npm package jsonlines, it gets resolved to a mirrored registry registry.npm.taobao.org rather than registry.npmjs.org. It only does this for jsonlines. What causes this? Here's the diff on my package-lock.json. The original…
Raine Revere
  • 30,985
  • 5
  • 40
  • 52
2
votes
1 answer

remove all the EOFs (extra empty lines) at the end of jsonl files

I am working with jsonl files that look something like this in VSCode editor: first.jsonl 1.{"ConnectionTime": 730669.644775033,"objectId": "eHFvTUNqTR","CustomName": "Relay Controller","FirmwareRevision": "FW V1.96","DeviceID":…
AOE_player
  • 536
  • 2
  • 11
2
votes
2 answers

merge & write two jsonl (json lines) files into a new jsonl file in python3.6

Hello I have two jsonl files like so: one.jsonl {"name": "one", "description": "testDescription...", "comment": "1"} {"name": "two", "description": "testDescription2...", "comment": "2"} second.jsonl {"name": "eleven", "description":…
WannabeSmith
  • 435
  • 4
  • 18
2
votes
1 answer

How to load jsonlines file with simple file read

Consider having the following code and a jsonl file, there is a specific reason I don't read file with jsonlines.open() api, so please take this as a fact. Reference for jsonlines…
JavaSa
  • 5,813
  • 16
  • 71
  • 121
2
votes
2 answers

How to extract elements from each line in a jsonline file?

I have a jsonl file which contains per line both a sentence and the tokens that are found in that sentence. I wish to extract the tokens from each line in the JSON lines file, but my loop only returns the tokens from the last line. This is the…
2
votes
1 answer

How do I modify a spring service to produce jsonl

I have a service consumer who wants my service to produce line delimited JSONL. How can I modify the Jackson parser or provide a custom serializer so that a retuned array of objects is serialized as JSONL and not JSON. For example the following…
Mark
  • 2,260
  • 18
  • 27
2
votes
1 answer

Make one (sub-)JSON object appearing on one line by jq

In Cloud BigQuery, the accepted JSON format is: One JSON object, including any nested/repeated fields, must appear on each line. refer to: https://cloud.google.com/bigquery/data-formats#json_format Now, given a json: { "1": { "kind":…
Drake Guan
  • 14,514
  • 15
  • 67
  • 94
2
votes
1 answer

Logstash - Issue parsing json_lines format

Probably a n00b issue trying to get the json_lines codec to read data from a file. Here's what my config file looks like input { file { path => ['C:/dev/logstash-5.1.2/data/sample.log'] start_position => "beginning" sincedb_path =>…
sgafur
  • 23
  • 1
  • 7
2
votes
1 answer

JSON Line issue when loading from import.io using Python

I'm having a hard time trying to load an API response from import.io into a file or a list. The enpoint I'm using is https://data.import.io/extractor/{0}/json/latest?_apikey={1} Previously all my scripts were set to use normal JSON and all was…
johan855
  • 1,578
  • 4
  • 26
  • 51
2
votes
1 answer

Efficiently get the first record of a JSONL file

Is it possible to efficiently get the first record of a JSONL file without consuming the entire stream / file? One way I have been able to inefficiently do so is the following: curl -s http://example.org/file.jsonl | jq -s '.[0]' I realize that…
btiernay
  • 7,873
  • 5
  • 42
  • 48
1
vote
2 answers

Need to modify an existing JQ filter of a GitHub CLI GraphQL response

I am creating a GitHub Action workflow which will call a GitHub CLI API request using GraphQL. This gh api graphql response is --paginate and returns JSON Lines (ndjson). I created the GraphQL and jq queries, and I am close to the desired output;…
Christopher Rucinski
  • 4,737
  • 2
  • 27
  • 58
1
vote
3 answers

Read a jsonl (json lines) file

Reading a json file could be possible with this commands: library(jsonlite) json_text <- readLines("tect.json", warn = FALSE, encoding = "UTF-8") Parse the JSON data json_data <- fromJSON(txt = paste(json_text, collapse = "")) in a format of data…
Erik Brole
  • 315
  • 9
1
vote
0 answers

I need to convert large json file 2go to csv file with python module json_lines

I tried this python code but it didn't work its keep running without any result: import json_lines import csv data = [] with open('xaa', 'rb') as f: for item in json_lines.reader(f): data.append(item) with open('data.csv', 'w',…
1
vote
1 answer

copying large file line by line is not exact

I'm trying to correctly read and write 1 million lines from the pile corpora with node.js. The problem is that I get an output file with one million lines but the 1 millionth line is the 900kish line of the original file. This what I used: fs…
user3776738
  • 214
  • 2
  • 10
  • 27
1
vote
2 answers

How to convert txt file to jsoinl lines file for Hungarian char.?

I have txt file that contians two columns (filename and text) the spreater during generating txt file is tab example of input file below : text.txt 23.jpg még 24.jpg több the expacted output_file.jsonl type json line format {"file_name":…
Mohammed
  • 346
  • 1
  • 12
1 2
3
10 11