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
1
vote
1 answer

Why does Pandas "utf-8-sig" encoding work but Dask doesn't?

file.json [{"id":1, "name":"Tim"}, {"id":2, "name":"Jim"}, {"id":3, "name":"Paul"}, {"id":4, "name":"Sam"}] It's encoded as 'UTF-8 with BOM" When I use pandas, it works df = pd.read_json('file.json', encoding='utf-8-sig', …
Guy Altman
  • 41
  • 4
1
vote
1 answer

Import JSON Lines into Pandas

I want to import a JSON lines file into pandas. I tried to import it like a regular JSON file, but it did not work: js = pd.read_json (r'C:\Users\Name\Downloads\profilenotes.jsonl')
Jed
  • 331
  • 2
  • 11
1
vote
2 answers

sorting values by key-value with minimal order manipulation on json lines

I have a file in the following format; Line 1 {"name": "Hotel Eiffel Petit Louvre", "detailed_city": "Europe | France | Ile-de-France | Paris", "review_rating": "3.870967741935484", "stars": "2.5", "max_price": "324", "min_price": "117", "ref":…
yusuf
  • 3,591
  • 8
  • 45
  • 86
1
vote
1 answer

Is there a way to customize Scrapy JSONlines exporer to not include Null/Default values?

I'm building some web scrapers using Scrapy with Pydantic. We are currently using the JSONlines item exporter to output the data into a file. Here is an example of a JSON line created by the scraper. { "timestamp": null, "deposit_date":…
1
vote
0 answers

Error when reading the first line in jsonl file in R

I have a file formatted in *.jsonl format, which I am trying to read in R and convert each of its objects to json. A reproducible data stored in the "filename.jsonl" is provided…
Dave
  • 329
  • 2
  • 10
1
vote
1 answer

Writing charcters in the csv files instead of writing the sentence

I want to save my data in the CSV format, I have some sentences and I want to save every sentence in a different row, but the output is like this: This is my code: with jsonlines.open('/content/data.jsonl') as reader: with…
Zahra Hosseini
  • 478
  • 2
  • 4
  • 14
1
vote
2 answers

Converting a text document into a jsonl (json lines) format

I want to convert a text file into a json lines format using Python. I need this to be applicable to a text file of any length (in characters or words). As an example, I want to convert the following text; A lot of effort in classification tasks is…
johnadem
  • 153
  • 2
  • 12
1
vote
1 answer

Convert dataframe to nested jsonl file

I need to convert a dataframe to a nested jsonl file in a specific way. I have the dataframe below and I constructed the column "quantity details" myself which means it was 2 saperate columns before. id price quantity details 0 12 …
JJasperr
  • 25
  • 4
1
vote
1 answer

How to turn a dataframe to jsonl with similar index for every line?

I have dataframe that has "input" as the index of all of the rows. Thousands of them. df1 = index item name item quantity input apple 4 input orange 3 input lemon 6 I need to turn it to a…
JJasperr
  • 25
  • 4
1
vote
2 answers

Convert JSON LINES file to JSON format?

I have file (around 6 GB) that each line is JSON. {"name":"name1", "age":40, "car":null} {"name":"name2", "age":30, "car":null} {"name":"name3", "age":30, "car":null} How can I convert it into a JSON array with Python?
yokjc232
  • 91
  • 5
1
vote
1 answer

Python Inserting headers for CSV file when converting JsonL to CSV File

currently working on a script to convert files from jsonl format to a CSV format and towards the end I wrote a line to include a header for the csv file to identify each variable converted. However, it seems that the CSV file generated from the…
honnielemons
  • 57
  • 1
  • 9
1
vote
1 answer

Python Converting JsonL to CSV File Permission Error 13

I'm currently working on a script that converts a jsonl to csv format. However, upon running the code on visual studio code's terminal, I get the following error: Traceback (most recent call last): File "C:\Users\Natthanon\Documents\Coding…
honnielemons
  • 57
  • 1
  • 9
1
vote
1 answer

How to manipulate jsonl objects

Given an API that returns a jsonl, how can I manipulate the data that I obtain? What if the API gives me data like this: {"plate": "pizza", "quantity": 3} {"plate": "pasta", "quantity": 2} In javascript the object retrieved what type will have? If…
Omar El Malak
  • 179
  • 1
  • 8
1
vote
1 answer

C# Type safe JSON-Lines Deserialization

Currently I am working with the Shopify GraphQL Bulk Query. This Query returns a JSON Lines file. Such a file may look like this: {"id":"gid:\/\/shopify\/Product\/5860091625632","title":"Levis Jeans","description":"Cool…
After_8
  • 189
  • 1
  • 4
  • 16
1
vote
2 answers

Load multiple folders containing several jsonl files into a Cloud Database in GCP (e.g.: BigQuery)

Data The data is formatted as several .jsonl.gz files in multiple folders, in a Google Cloud Storage bucket. For example, the files I would load, if I loaded the data file-by-file would be something…