Skip to content

๐Ÿ Utilities for using JSONL (JSON lines) file type with Python

License

Notifications You must be signed in to change notification settings

MartinKondor/jsonl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

jsonl

Project Status version GitHub Issues Contributions welcome

Utilities for using JSONL (JSON lines) file type with Python.

Getting Started

Prerequisites

  • Python 3.6+
  • Python modules from the requirements.txt

Deployment

Dowload and install the dependencies with the command:

$ python -m pip install -r requirements.txt

Usage

Install the module.

pip install git+https://github.com/MartinKondor/jsonl.git

Import and define a list of objects to work with.

from typing import List, Any
from jsonl import jsonl


a: List[Any] = [
    {"first_name": "Joe1", "last_name": "Doe1"},
    {"first_name": "Joe2", "last_name": "Doe2"},
    {"first_name": "Joe3", "last_name": "Doe3"},
]

Save the object to a file:

jsonl.dump(a, "dummy_data.jsonl")

Append an object to a file (works even if the file didn't exist).

obj: Any = {"first_name": "Joe_Appended", "last_name": "Doe_Appended"}
jsonl.append(obj, "dummy_data.jsonl")

Load a jsonl file:

data = jsonl.load("dummy_data.jsonl")

Print out the JSON object nicely:

jsonl.print(data)

Contributing

This project is open for any kind of contribution from anyone.

Steps

  1. Fork this repository
  2. Create a new branch (optional)
  3. Clone it
  4. Make your changes
  5. Upload them
  6. Make a pull request here

Authors

License

Copyright (C) 2023-2024 Martin Kondor.

See the LICENSE file for details.

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy