Saravanan666/pypi-org huggingface dataset:
Package: jsoninja
JsoninjaA library that allows you to generate JSON's fromtemplates written with Python data types.Instalation$ pip install jsoninjaUse Case ExamplesYou can use the main Python data types:fromjsoninjaimportJsoninjajsoninja=Jsoninja()template={"foo":"{{variable_name}}",}replacements={"variable_name":"bar",}result=jsoninja.replace(template,replacements)# {#   "foo": "bar",# }Allows multiple replacements of the same variable:fromjsoninjaimportJsoninjajsoninja=Jsoninja()template={"message1":"{{message}}","message2":"{{message}}","message3":"{{message}}",}replacements={"message":"I am duplicated!",}result=jsoninja.replace(template,replacements)# {#   "message1": "I am duplicated!",#   "message2": "I am duplicated!",#   "message3": "I am duplicated!",# }Use callback functions to generate the values to be replaced:fromjsoninjaimportJsoninjadefgenerate_password()->str:return"super_secret_password"jsoninja=Jsoninja()template={"password":"{{password}}",}replacements={"password":generate_password,}result=jsoninja.replace(template,replacements)# {#   "password": "super_secret_password",# }Support for variables in the dict keys (replacements must be str, int, float or bool):fromjsoninjaimportJsoninjajsoninja=Jsoninja()template={"{{variable_name}}":"bar",}replacements={"variable_name":"foo",}result=jsoninja.replace(template,replacements)# {#   "foo": "bar",# }Known LimitationsWhen replacing a variable declared in adictkey, the order will change.
Package: jsonio
jsonioThejsoniopackage provides utility functions for reading and writing JSON data. It supports the following features:Easy Read/WriteWorks Just Like ThejsonLibrarySupportsdatetime/dateObjectsSupportsdataclasses(Python 3.7+)Preserve OrderingInstallationpip install jsonioEasy Read/WriteReadimportjsoniodata=jsonio.read('/foo/bar.json')Writeimportjsoniojsonio.write({'foo':'bar'},'/foo/bar.json')Works Just Like ThejsonLibraryLoadimportjsoniowithopen('/foo/bar.json','r')asjsonfile:data=jsonio.load(jsonfile)Loadsimportjsoniodata=jsonio.loads('{"foo": "bar"}')Dumpimportjsoniowithopen('/foo/bar.json','w')asjsonfile:jsonio.dump({'foo':'bar'},jsonfile)Dumpsimportjsoniodata={'apple':'crumble','banana':'split',}# Use standard options.text=jsonio.dumps(data,jsonfile,indent=2,sort_keys=True)Supportsdate/datetimeObjectsimportdatetimeimportjsoniobefore={'date':datetime.date.today(),'timestamp':datetime.datetime.now(),}data=jsonio.dumps(before)after=jsonio.loads(data)assertbefore==after# TrueSupportsdataclasses(Python 3.7+)fromdataclassesimportdataclassimportjsonio@dataclassclassFruit:apple:strbanana:strbefore=Fruit(apple='Fuji',banana='Lady Finger')data=jsonio.dumps(before)after=jsonio.loads(data)assertbefore==after# TruePreserve Ordering - i.e.OrderedDictObjectsimportcollectionsimportjsoniobefore=collections.OrderedDict([('banana','split'),('apple','crumble')])text=jsonio.dumps(before,indent=2)after=jsonio.loads(text,ordered=True)assertbefore==after# True
Package: jsonism
Jsonism - The Simple Python JSON CheckerA super-simple library for validating JSON against a schema.Install from pippip install jsonismWhy use Jsonism?Jsonism is a great alternative tojsonschemawhen you just want to do some simple validation of JSON without your code getting horrendously complicated.It's quick to set up a basic schema checker.Example usageImport the checkerfromjsonism.checkerimportvalidateThevalidatefunction returnsTrueif the input you give it matches the schema that you provide.Basic flat objectsschema={"Bob":str,"Lucy":int,"Bert":bool}input={"Bob":"Is Bob","Lucy":13,"Bert":True}validate(input,schema)Listsinput=["Bob","Alice","John"]schema=[str]validate(input,schema)Other stuffinput={"Usernames":[{"username":"Bob","age":23},{"username":"Bill","age":98}]}schema={"Usernames":[{"username":str,"age":int}]}validate(input,schema)Obviously for more complex json, you canjson.loadsthe input.Permissive validationJsonism ispermissivewhen it comes to extra elements. As long as the elements listed in the schema are provided,validatewill returnTrue. If additional elements are added to the input,validatewill still returnTrue.schema={"Bob":str,"Lucy":int,"Bert":bool}input={"Bob":"Is Bob","Lucy":13,"Bert":True,"Colin":21}validate(input,schema)# Will return TrueValue validationThis is absolutely optional, in order to keep things as simple as possible and enable the use of the in-built typesint,str,bool, andfloatwherever possible. But we do also support the use of value validation as follows:fromjsonism.checkerimportvalidatefromjsonism.typesimportString,Integer,Boolean,Floatschema={"Bob":String(len=6),"Lucy":Integer(max=96),"Bert":Boolean(allowed=True),"Chris":Float(min=12.34)}input={"Bob":"Is Bob","Lucy":30,"Bert":True,"Chris":34.2}validate(input,schema)# Will return TrueLists of valid valuesfromjsonism.checkerimportvalidatefromjsonism.typesimportString,Integer,Boolean,Floatschema={"Bob":String(options=["Is Bob","Not Bob"]),"Lucy":Integer(max=22),"Bert":Boolean(allowed=True)}input={"Bob":"Was Bob","Lucy":22,"Bert":True}validate(input,schema)# Will return FalseBut it doesn't have featurex!Well, I did say it was simple. It will always support the very simple initialisation shown above. We also now support value validation. If you have a burning desire to add a feature, please either post an issue or make a pull request athttps://github.com/bmcollier/jsonism.
Package: jsonjsc
jsonjscA Python library for parsing out C/Javascript style comments in JSON files.Installpip install jsonjscFeaturesSimple and easy to use library with no other dependencies.Supports C/JS block (/* */) and single line (//) comments.Retains the line number and character column of JSON content after parsing, letting syntax error positions get properly reported by the normal Python JSON decoder.Is easily dropped into existing JSON library usage as a decoder class.Test backed viaunittest.Python 2jsonjsc v1.1.2 is the last version to support Python 2.7.pip install jsonjsc==1.1.2ExampleimportjsonimportjsonjscTEST_JSON_DECODER=r'''{/*This is a test of the JSON decoder in full*/"test1": "message1", // this comment should parse out.// "junk1": "message",/*"junk2": "another message",*/"test2": "message2"}'''test=json.loads(TEST_JSON_DECODER,cls=jsonjsc.JSONCommentDecoder)print(test["test1"])if"junk1"notintest:print("I guess junk1 was commented out?")if"junk2"notintest:print("I guess junk2 was commented out too!")print(test["test2"])Developmentjsonjsc usesHatchlingas a build backend andflake8as a style guide.$ pip install -e .Hatchis the primary project manager of choice, but any project adhering to PEP 621 (pyproject.tomlspecification) can be used.$ hatch shellTestsTests can be ran withpytest. Hatch scripts are included for linting and testing.# Lint
$ hatch run lint:all

# Test with current Python version
$ hatch run full
# Test with all Python versions
$ hatch run test:fullTODOsImplementation could probably be sped up significantly as it uses character by character searches to test if comments are in string values or not. No performance metrics have been taken.LicenseLicensed under the MIT License. See LICENSE for more information.
Package: jsonkeysearch
jsonkeysearchDescriptionjsonkeysearchis a Python library that recursively searches for keys in JSON format files.InstallactionUsagefromjsonkeysearchimportJSONKeySearch# https://json.org/example.htmljson_example={"menu":{"id":"file","value":"File","popup":{"menuitem":[{"value":"New","onclick":"CreateNewDoc()"},{"value":"Open","onclick":"OpenDoc()"},{"value":"Close","onclick":"CloseDoc()"},]},}}target=JSONKeySearch(json_example)# [1] Append all dictionary with onclick as key in a listkey_="onclick"value_=""# All value in keytarget.search(key=key_,value=value_)print(target.jsonObject)# [#     {"value": "New", "onclick": "CreateNewDoc()"},#     {"value": "Open", "onclick": "OpenDoc()"},#     {"value": "Close", "onclick": "CloseDoc()"},# ]# [2] Append dictionary in a list with onclick as key and 'Open' as valuekey_="onclick"value_="Open"target.search(key=key_,value=value_)print(target.jsonObject)# [{"value": "Open", "onclick": "OpenDoc()"}]fordict_intarget.jsonObject:print(dict_[key_])# 'OpenDoc()'
Package: jsonklog
Project JSONkLogThe goal of this library is to provide a simple formatter, and handlers for
standard python logging libraries to deal with JSON output in a sort of
“set it and forget it” methodology that python logging currently provides.Formatters :Currently there are two formatters:JSONFormatterJSONFormatterSimpleEach of the formatters processes the standard python logging messages into JSON
however the “Simple” library provides a limited output including only 3 key elements
and the mysterious 4th element “Extras”Please note that “extras” as a dictionary requires the content to be nested under
the “extra” key within the dictionaryFor examples, please see example_formatter.py within the source tree at:http://www.github.com/neogenix/jsonklog/examplesHandlers :Currently there are two handlers, which require JSONFormatter, or JSONFormatterSimple
to have been used :MongoDBHandlerElasticSearchHandlerEach of the handlers can process the standard JSON messages from the included JSON
formatting libraries, and can have different destinations specified as follows:MongoDBHandler :This handler speaks MongoDB (using ‘pymongo’), and can take the following arguments:host - The destination host / ip of the MongoDB serverport - The destination port of the MongoDB serverdb - The destination database to send messages tocollection - The destination collection to send messages tofor more on MongoDB see the following URL:http://www.mongodb.org/ElasticSearchHandler :This handler speaks ElasticSearch (using ‘requests’), and can take the following arguments:host - The destination host / ip of the ElasticSearch serverport - The destination port of the ElasticSearch serverindex - The destination index to send messages todoc_type - The destination doc_type to send messages tofor more on ElasticSearch see the following URL:http://www.elasticsearch.org/Note :To format your JSON into “human readable whatsits” ensure your handler outputs
to stdout, and then pipe through the node-json library (‘json’), installed as per:npm install -g jsonThis is not a requirement, but rather what I’m using to do my testing ;)History0.15.0 (2012-06-25)Added additional examples, and moved them to /examplesAdded more documentationReformatted handlers to make them easier to work withMade handlers depend on json formatters0.10.0 (2012-06-19)Initial release of MongoDBHandler, and ElasticSearchHandlerInitial documentation around Handlers.Example code added for handler.py0.05.0 (2012-06-14)Initial release of JSONFormatter, and JSONFormatterSimpleInitial documentation addedExample code added for formatter.py0.01.0 (2012-06-10)Initial release
Package: json-kvs
json_kvs is dependency free library for key/value storage, based on json filejson_kvs can receive optional 'scope' parameter, what allows to use same file in multiple scripts simultaneouslyInstallationpip install json_kvsUsagekvsObj = KVS('path_to_json_file', scope='scope_name'(OPTIONAL))kvsObj.set_value('key', 'value')  -- write valuekvsObj.get_value('key')           -- reade valueExamplefromjson_kvsimportKVSkey='key1'value='val1'scope='test_scope1'pathToJson='/tmp/kvs.json'kvsObj=KVS(pathToJson,scope=scope)kvsObj.set_value(key,value)print(kvsObj.get_value(key))LicenseMIT
Package: jsonl2
Json Line librarythis is a library aiming to handle json line files.What is a Json line file (*.jsonl)A json line file is a text file where each line is a single json document.The advantages to have a jsonl file are:fast reading, we don't need to wait to read the entire file to know dataskip lines very fast without parsing json documentswe can read a jsonl file in parallelInstallationpip install jsonlUsagefromjsonlimportJsonl#read whole filedata0=[xforxinJsonl("/path/to/file")]#alternative to readdata1=list(Jsonl("/path/to/file"))#read 100 rows after row 20data2=[xforxinJsonl("/path/to/file",offset=20,limit=100)]#write objectsdata3=[{"name":"Newton"},{"name":"Galileo"}]Jsonl("/path/to/file","w").write(data3)If the file is located in the cloud,
you only need to configure your environmentJsonlclass will handle it for aws, gcp, etc.Jsonlcan handle.zipor.gzfiles automatically
you only need to specify the right extension in the path#Author
Pedro Mayorga.
Package: jsonl2json
Jsonl2jsonA Python library for converting data in the JSON Lines (.jsonl) format to the standard JSON (.json) formatInstallationYou can installjsonl2jsonusingpip:pipinstalljsonl2jsonUsageYou can usejsonl2jsonin your Python code like this:fromjsonl2jsonimportJsonlToJsonFormatterjsonl=JsonlToJsonFormatter('input.jsonl','output.json')jsonl.to_json()This will read the input file input.jsonl and write a JSON array to the output file output.json.Licensejsonltojson is released under the MITLicense.txt. See LICENSE for more information.
Package: jsonlab
jsonlab介绍众所周知，python内置的json不提供将json字符串序列化成json字符串(__dict__可序列化一层字典，不能递归)
，也不提供将json字符串反向序列化成类对象的功能，为了解决这个痛点，再多方寻找无果后，决心自己开发提供该功能的库，现已开发完毕，在此公布于大众，以造福全人类。安装pip3 install jsonlab使用场景该库适用于对自定义类型的json序列化和json反序列化，比如我们在网络通信时定义了自己的模型，我们便可通过该库来将自定义类型实例序列化成json字符串发送，或者将接收到得json字符串反序列化成类实例。注意由于json序列化和反序列化时我们需要知道对象的类型，然而python语言的弱类型特征不能直观的获取属性类型，所以在使用这个库时有个约定：1. 自定义的类型必须实现 __init__ 方法，且 __init__ 方法中必须包含所有要序列化反序列化的属性，并且，这些属性必须作为形参出现在 __init__ 方法的形参列表中，并且需要有对应的类型注解

2. 序列化/反序列化时是以 __init__ 函数中形参名作为key值，所以为了防止不必要的bug，请保持形参名和属性名一致例1：下面的Person类是一个典型的满足需求的定义classPerson(object):def__init__(self,name:str,age:int):self.name=nameself.age=age# orclassPerson(object):def__init__(self,name:str="kainhuck",age:int=18):self.name=nameself.age=age例2：下面的Person类中hobby属性将不会被序列化或反序列化classPerson(object):def__init__(self,name:str,age:int,hobby):self.name=nameself.age=ageself.hobby=hobby# orclassPerson(object):def__init__(self,name:str,age:int):self.name=nameself.age=ageself.hobby=""例3：下面例子演示了继承类的写法classB(object):def__init__(self,b_name:str):self.b_name=b_nameclassA(B):def__init__(self,a_name:str,b_name:str):super().__init__(b_name)self.a_name=a_name例4：下面的例子演示了属性是其他类型的情况classB(object):def__init__(self,b_name:str):self.b_name=b_nameclassA(object):def__init__(self,a_name:str,b:B):self.a_name=a_nameself.b=b例5：下面的例子演示了列表的使用, 需要注意的是:如果一个类的属性是个列表，则可以使用list或者[子类型]如果采用第二种写法，目前只支持一种类型，也就len([子类型]) == 1子类型支持一下几种情况子类型名描述str内置类型 -- 字符串int内置类型 -- 整数float内置类型 -- 浮点数bool内置类型 -- 布尔list内置类型 -- 普通列表(内部不可为自定义类型)dict内置类型 -- 普通字典(内部不可为自定义类型)object表示支持任意类型（但是不支持自定义类型） [object] == list自定义类型自定义类型，目前只支持一个，也就是说一个list内部只有一种自定义类型[子类型]嵌套list{key类型:子类型}嵌套字典classA:def__init__(self,values:[str]):self.values=values# orclassB:def__init__(self,b_name:str):self.b_name=b_nameclassA:def__init__(self,values:[B]):self.values=values# orclassA:def__init__(self,values:[[str]]):self.values=values# orclassA:def__init__(self,values:[{str:object}]):self.values=values例6：下面的例子演示了字典的使用，需要注意的是：如果一个类的属性是个字典，则可以使用dict或者{key类型:value类型}如果采用第二种写法，目前只支持一种类型，也就len({key类型:value类型}) == 1key类型支持如下strintfloatboolvalue类型支持如下类型名描述str内置类型 -- 字符串int内置类型 -- 整数float内置类型 -- 浮点数bool内置类型 -- 布尔list内置类型 -- 普通列表(内部不可为自定义类型)dict内置类型 -- 普通字典(内部不可为自定义类型)object表示支持任意类型（但是不支持自定义类型） [object] == list自定义类型自定义类型，目前只支持一个，也就是说一个list内部只有一种自定义类型[子类型]嵌套list{key类型:子类型}嵌套字典classA:def__init__(self,values:{str:str}):self.values=values# orclassB:def__init__(self,b_name:str):self.b_name=b_nameclassA:def__init__(self,values:{str:B}):self.values=values# orclassA:def__init__(self,values:{str:[str]}):self.values=values# orclassA:def__init__(self,values:{str:{str:object}}):self.values=valuesUsage接口marshal(obj) -> str传递一个类实例，返回一个序列化后的json字符串marshal_to_dict(obj) -> dict传递一个类实例，返回一个字典对象unmarshal(json_, type_: type)第一个参数可以是: json字符串，bytes类型的json字符串，字典对象第二个参数是自定义类型返回自定义类型的实例demo序列化:demo反序列化:demo
Package: jsonlf
jsonlfThis is a json line formarter. It expects a valid json on stdin and outputs it pretty-printed and usespygmentsfor highlighting. It will also attempt to format python tracebacks.InstallationpipinstalljsonlfUsagesome_command_that_logs_json_lines|jsonlfYou can use pygments styles listed here:https://pygments.org/styles/Just pass their names as the first argument. Example:some_command_that_logs_json_lines|jsonlfemacs
Package: jsonlibconfig
JSONLibconfig:sparkles: Pure python implementation library provides JSON <- convert -> LibconfigInstallpip install jsonlibconfigCLI Usageλ~/jsonlibconfig-h
usage:jsonlibconfig[-h][--target{json,libconfig}][--pretty][--hextoint][--fileFILE]PurepythonlibraryprovidesJSON<-convert-->Libconfig

optionalarguments:-h,--helpshowthishelpmessageandexit--target{json,libconfig}specifyoutputformat:json,libconfig(default:libconfig)--prettyPrettyprint--hextointConvertHEXstringtointeger(onlyforjson)--fileFILEInputfileJSON to Libconfigcatexample.cfg|jsonlibconfig--targetjson{"hours": {"mon": {"close": 18, "open": 9}, "wed": {"close": 18, "open": 9}, "sun": {"close": 16, "open": 11}, "fri": {"close": 20, "open": 9}, "sat": {"close": 20, "open": 9}, "thu": {"close": 18, "open": 9}, "tue": {"close": 18, "open": 9}}, "name": "Books, Movies & More", "inventory": {"movies": [{"media": "DVD", "price": 19.99, "qty": 11, "title": "Brazil"}, {"media": "DVD", "price": 18.99, "qty": 5, "title": "The City of Lost Children"}, {"media": "Blu-Ray", "price": 24.99, "qty": 20, "title": "Memento"}, {"title": "Howard the Duck"}], "books": [{"price": 29.99, "author": "Robert Louis Stevenson", "qty": 5, "title": "Treasure Island"}, {"price": 9.99, "author": "Neal Stephenson", "qty": 8, "title": "Snow Crash"}]}}Libconfig to JSONcatexample.json|jsonlibconfig--prettyhours = {
    wed = {
      close = 18; 
      open = 9; 
    }; 
    sun = {
      close = 16; 
      open = 11; 
    }; 
    fri = {
      close = 20; 
      open = 9; 
    }; 
    tue = {
      close = 18; 
      open = 9; 
    }; 
    mon = {
      close = 18; 
      open = 9; 
    }; 
    thu = {
      close = 18; 
      open = 9; 
    }; 
    sat = {
      close = 20; 
      open = 9; 
    }; 
  }; 
  name = "Books, Movies & More"; 
  inventory = {
    movies = (
      {
        media = "DVD"; 
        price = 19.99; 
        title = "Brazil"; 
        qty = 11; 
      }, 
      {
        media = "DVD"; 
        price = 18.99; 
        title = "The City of Lost Children"; 
        qty = 5; 
      }, 
      {
        media = "Blu-Ray"; 
        price = 24.99; 
        title = "Memento"; 
        qty = 20; 
      }, 
      {
        title = "Howard the Duck"; 
      }
    ); 
    books = (
      {
        title = "Treasure Island"; 
        price = 29.99; 
        qty = 5; 
        author = "Robert Louis Stevenson"; 
      }, 
      {
        title = "Snow Crash"; 
        price = 9.99; 
        qty = 8; 
        author = "Neal Stephenson"; 
      }
    ); 
  };APIfromjsonlibconfigimportencoderfromjsonlibconfigimportdecoderfrom json to libconfigencoder.dumps(json.loads(inputs))from libconfig to jsondecoder.loads(inputs))LicenseMIT
Package: jsonlike
# jsonlike [![Build Status](https://travis-ci.org/shaunvxc/jsonlike.svg?branch=master)](https://travis-ci.org/shaunvxc/jsonlike) [![PyPI version](https://badge.fury.io/py/jsonlike.svg)](https://badge.fury.io/py/jsonlike)
###Why?
Sometimes, especially when working withJSONdata from the web, you will find that the data format is not quite JSON and thus have to do a little bit of fighting with it in order to successfully calljson.loads().###Goal
The goal of this package istryand provide the same functionality asjson.loads()for data thatlookslike JSON, but doesn’t play nicely withjson.loads()or other common solutions.In its current state, it simply applies some heuristics that solve some of the common cases I’ve run into while working with not-quitejsonstructured data. Overtime, I’d like to see it turn into something a bit more robust.###Usage`python import jsonlike jsonlike.loads(invalid_json_string) `Currently,jsonlike.loadswill
* strip out bad escape characters
* strip out HTML content with JSON values
* add missing commas
* correct errors due to nested“’s##### Strip response callback wrappers`python import jsonlikejsonlike.unwrap_and_load("callback({"a":""hello""})")# yields{"a":"hello"}`For JSON surrounded by a callback wrapper, callingunwrap_and_loadwill use theunwrapperlibrary to strip away the callback, before returningloads()on the remaining content.###Installation$ pip install jsonlike## Contributing
1. Fork it (https://github.com/shaunvxc/envy/fork)
1. Create your feature branch (git checkout -b new-feature)
1. Commit your changes (git commit -am ‘Add some feature’)
1. Run the tests (make test)
1. Push change to the branch (git push origin new-feature)
1. Create a Pull Request
Package: jsonline
JsonlineJsonline is intend to use to explore and work with json lines files and avoid keep the entire data in memory or constantly read the whole file.This library handle json lines files as it was a read only list, but withappendtoo. This library build and index with the position of the being and end of each json in the file. When an element is accessed we use the mentioned index to read only the line with the requested json. This index is efficient handled and store in gzip format with extension.json.idx.ExamplefromjsonlineimporjsonLine# the extension .json is't necessarydata=jsonLine('my_file')data.append({'test':1})# extend is an efficient way to append several elementsdata.extend([{'test':1},{'another_test':2}])print(data[1])# random accessforiindata:print(i)data.close()# close whe finish using data# also support context managerwithjsonLine('my_file')asdata:print(data[0])
Package: json-lines
This is a tiny library for reading JSON lines (.jl) files,
including gzipped and broken files.JSON linesis a text file format
where each line is a single json encoded item.Why?Reading a well-formed JSON lines file is a one-liner in Python.
But the file can be broken: cut at some point
(this happens when the process writing it is killed),
or concatenated from several cut pieces
(this happend when the process started appending to the same file again).
Handling all this cases is not easy, especially if the file is compressed.json-lines handles all this cases for you!Installationpip install json-linesIfujsonis installed, it is used
to speed up json decoding (which is the main performance bottleneck
even for gzipped files).UsageIn order to read a well-formed json lined file,
pass an open file as the first argument tojson_lines.reader.
The file can be opened
in text or binary mode, but if it’s opened in text mode, the encoding
must be set correctly:import json_lines

with open('file.jl', 'rb') as f:
    for item in json_lines.reader(f):
        print(item['x'])There is also a helper functionjson_lines.openthat recognizes
“.gz” and “.gzip” extensions and opens them withgzip:with json_lines.open('file.jl.gz') as f:
    for item in f:
        print(item['x'])Handling broken (cut at some point) files is enabled by passingbroken=Truetojson_lines.readerorjson_lines.open.
Broken lines are skipped (only logging a warning), and reading continues
from the next valid position.
This works both for compressed and uncompressed files:with json_lines.open('file.jl.gz', broken=True) as f:
    for item in f:
        print(item['x'])LicenseLicense is MIT.
Package: json-lines-to-object
OverviewThis is a simple tool to convert whitespace-separated items on separate lines to a JSON object.InstallUse PyPI:$ pip install json_lines_to_objectExampleJust pipe the data in:$ printf "key1 value1\nkey2 value2\nkey3 value3 value33" | jlto
{
    "key1": "value1",
    "key2": "value2",
    "key3": "value3 value33"
}FeaturesWill ignore newlines.OptionsCan be told to skip hash-commented lines.Can be told to automatically add an empty string for a value if there is only one part on the line (causes error by default).Can be told to allow duplicate keys (causes error by default).Can be told to flip the keys and values (the values will be the keys).See command-line help for more information.