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
0
votes
2 answers

Merge multiple JSONL files from a folder using Python

I'm looking for a solution to merge multiples JSONL files from one folder using a Python script. Something like the script below that works for JSON files. import json import glob result = [] for f in glob.glob("*.json"): with jsonlines.open(f)…
MFatn
  • 39
  • 2
  • 11
0
votes
1 answer

Python removing .jsonl extension when converting JsonL to CSV File

I have with me a script that converts jsonl files in a selected directory to csv files in another specified location. However, upon converting the files to csv format, the final created csv file contains a .jsonl extension before the .csv (Think…
honnielemons
  • 57
  • 1
  • 9
0
votes
1 answer

Python: Converting JsonL to Json to CSV

currently working with jsonl files and I intend to convert it into CSV format to run it through a program. However, I realize that it would be better to convert it from json directly to CSV instead, and I wrote a code below to convert json to csv.…
honnielemons
  • 57
  • 1
  • 9
0
votes
2 answers

Try to Select jsonl data column in another columns with .loc but got KeyError even though the key exists

this is my data structure in jsonl "content": "Not yall gassing up a gay boy with no rhythm", "place": {"_type": "snscrape.modules.twitter.Place", "fullName": "Manhattan, NY", "name": "Manhattan", "type": "city", "country": "United States",…
0
votes
1 answer

Auto-extracting columns from nested dictionaries in pandas

So I have this nested multiple dictionaries in a jsonl file column as below: `df['referenced_tweets'][0]` producing (shortened output) 'id': '1392893055112400898', 'public_metrics': {'retweet_count': 0, 'reply_count': 1, …
Swag'O
  • 23
  • 1
  • 4
0
votes
1 answer

jsonl-to-conll conversion tool application error

I need to convert a jsonl file to conll and i found this tool https://pypi.org/project/jsonl-to-conll/ but there is no examples or detailed documentation i tried this command line on command prompt C:\Users\Downloads>jsonl-to-conll…
eya_bklt
  • 305
  • 3
  • 10
0
votes
1 answer

How to convert lines of text to JSON Lines?

If you have a text file with many lines of text, is there a readily available way to convert it into the JSON Lines format? Example text file contains: This is the first line. This is the "second" line. This is the \third/ line. This is the {fourth}…
codingChicken
  • 191
  • 12
0
votes
1 answer

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa3 in position 886: invalid start byte: jsonlines

I am trying to read lines from a jsonl file, but I am getting the following error. Traceback (most recent call last): File "insertion_script.py", line 12, in for line in f.iter(): File…
mustafa zaki
  • 367
  • 1
  • 6
  • 20
0
votes
1 answer

Convert JSON dictionary to JSON lines using jQ

I have a Json file named some_file.json: { "dog": { "breed_1": 12, "breed_2": 20, }, "cat": { "breed_1": 6, "breed_2": 8, }, } I want to convert it to the below json lines…
dhamechaSpeaks
  • 127
  • 1
  • 1
  • 6
0
votes
1 answer

JQ separate output

i have a json formatted in this way : { "first_name": "Mario", "last_name": "Bros", "email": "mario.bros@mario.com", } { "first_name": "Luigi", "last_name": "Bros", "email": "luigi.bros@mario.com", } I have this output with jq…
0
votes
1 answer

Not able to create dataframe out of multi line json string or JSONL string using spark

I have been trying to form data frame out of jsonl string. I'm able to form data frame but the problem is only single row is being read, ignoring other. Here are things I tries in spark-shell // This one is example multiline json. val jsonEx =…
Sachin Doiphode
  • 431
  • 2
  • 10
  • 24
0
votes
1 answer

Convert JSON to JSONL in API Gateway velocity mapping template

I have an array of objects in JSON format coming in on the request. I would like to transform these objects into single line JSON (JSONL) in the velocity mapping template. Is this possible? Going from: [ { "something": "else", "another":…
RobotEyes
  • 4,929
  • 6
  • 42
  • 57
0
votes
1 answer

Loading a very large jsonl in pandas returns ValueError

I'm trying to load a very large jsonl file (>50 GB) using chunks in pandas reader = pd.read_json("January.jsonl", lines = True, chunksize = 10000) for chunk in reader: df = chunk This code starts, runs for a while an then returns this…
0
votes
1 answer

How to JSONL serialize sets in YAML style?

There are the three well-known format: JSON JSONL YAML It is well-known, that JSON can not handle Python sets without custom encoders/decoders. YAML 1.2 is strict superset of JSON JSONL is JSON written in one line I want to serialize (and…
dlazesz
  • 168
  • 17
0
votes
2 answers

How to convert JSON to JSON lines

I am new to JavaScript. I am building an array of objects. I need to stringify it, get rid of the square brackets, and split each object on ',' and put on new line. Need to go…