Saravanan666/pypi-org huggingface dataset:
Package: json2unique
JSON To UniqueParses theJSONdocument into a list of unique elementsInstructionsjson2unique--helpusage: json2unique [-h] [-d DEPTH] [infile] [outfile]

JSON parser

positional arguments:
  infile                the path to the JSON file to be parsed
  outfile               the path to the output file

optional arguments:
  -h, --help            show this help message and exit
  -d DEPTH, --depth DEPTH
                        set maximum recursion depthIf the optionalinfileoroutfilearguments are not passed to utility,STDINandSTDOUTwill be considered as default values.For large JSON files with many nested objects, you can manually increase the recursion depth using-dflag. The default value is10_000.UsageCommand Line InterfaceYou can use this package both as a CLI utility and as a library. Here is an example of how to use it in the terminal:json2uniquearray.json[1, 2, 42]You can use Unix pipes to read STDIN and write to STDOUT streams:echo'{"a": 1}'|json2unique>result.txt
catresult.txt[1, 'a']Manually type the desired JSON in the terminal (pressCtrl+Dwhen finish typing):json2unique{"a":[34,"hello",-343.56]}['a', -343.56, 34, 'hello']Use standard CLI Unix utilities to process the program's output:json2uniquearray.json|grep42[1, 2, 42]If there is a non-valid JSON,json2uniquewill throw an appropriate exception and terminate with a non-zero code:echo'{"a": 1""}'|json2uniqueExpecting ',' delimiter: line 1 column 8 (char 7)Last exit code is:echo$?1Python LibraryTo use this module as a library, enter the following line:importjson2uniquejson2unique.parse_json_to_list_of_unique({"a":1})# [1, 'a']
Package: json2Xconverter
Json_X_ConverterUnder construction! Not ready for use yet! Currently experimenting and planning!Developed by Snehal Borkar (c) 2022Examples of How To Use (Buggy Alpha Version)Import classesfromjson2Xconverter.api_call_flatimportApiCall,Flattenfromjson2Xconverter.x_converterimportXConverterdata=ApiCall.api_call(url)print(data)df=Flatten.flatten_json(data)print(df)XConverter(df,"test.csv").df_csv()Methods available in api_resp_flat module - ApiCallFlat classapi_call(url)-Call Api and returns json dataApiCall.api_call(url)flatten_json(data)- Take data of type <class: dict> as parameter flatten it and  converts to pandas dataframeFlatten.flatten_json(data)##Methods available in x_converter module - XConverter classobj = XConverter(df,file_name)obj.df_csv()obj.df_xml()obj.df_html()obj.df_pdf(html_filename)
Package: json4humans
json4humansPython tools for JSONC and JSON5 (aka. JSON for humans)This package provider parsing and serialization (with style preservation)
as well as linting, formatting and cli tools forJSON-derived syntaxes.Getting startedAddjson4humansas a dependency to your project:# pippipinstalljson4humans# pipenvpipenvinstalljson4humans# PDMpdmaddjson4humansThen import the proper module and use it like you would with the builtinjsonmodule:frompathlibimportPathfromjson4humansimportjsonmy_file=Path(__file__).parent/"my_file.json"# Load datawithmy_file.open()asf:data=json.load(f)# Editdata["attr"]="value"# Save with style preservationwithmy_file.open("w")asout:json.dump(out,data)FeaturesManipulate all supported format with the exact same API. Currently supported:JSONJSONCJSON5Parsed data supports native types comparison while preserving styleSupport serialization for both native types and providedJSONTypeSupports formattingSupports lintingAll features availables as a standalone cliSupportjq-like queriesDocumentationDocumentation is available athttps://json4humans.rtfd.ioContributingRead thededicated contributing guidelines.
Package: json4tree
json4treeMakes any JSON compatible withD3's hierarchy or tree chart formats.InstallationSince this tool is exclusivelyPython3, you'll needpip3to install:pip3 install json4treeYou can also download and install the package directly fromPyPi.UsageIf yourPython3library is included in your path, try runningjson4treedirectly from the command line:# if you have your Python3 scripts added to your path, use this one:json4treeinput.jsonoutput.json# otherwise, use this one:python3-mjson4treeinput.jsonoutput.jsonIf you need to import it as a module in yourPython3script, do itlike so:# import the necessary modulesimportjsonimportjson4tree# import your JSON datainfile=open("input.json","r")json_file=json.load(infile)infile.close()# create a new handlerconverter=json4tree.handler(json_file)# You can either print your results...converter.results# Or you can save your resultsoutfile=open("output.json","w")outfile.write(converter.results)outfile.close()ExamplesHere is an exampleinput filefromMerriam-Webster's Dictionary APIand the resultingoutput file.
Package: json5kit
json5kitA Roundtrip parser and CST for JSON, JSONC and JSON5.JSON5is a superset of JSON, that allows trailing commas,
comments, unquoted and single-quoted object keys, and a lot more.Currently supports parsing most JSON5 syntax, and converting it back to source.
Also supports single line// comments.Installationpipinstalljson5kitUsage>>>source="""... {...   items: [1, 2, 4],  // change this to 3... }... """>>>importjson5kit>>>tree=json5kit.parse(source)>>>print(tree.to_source()){items:[1,2,4],//changethisto3}>>>print(tree.to_json()){"items":[1,2,4]}>>># Let's replace the `4` with `3` now:>>>classReplaceFourWithThree(json5kit.Json5Transformer):...defvisit_Number(self,node):...ifnode.value==4:...returnnode.replace(value=3)...returnnode...>>>ReplaceFourWithThree().visit(tree)>>>print(tree.to_source()){items:[1,2,3],//changethisto3}>>>print(tree.to_json()){"items":[1,2,3]}Development / TestingClone the project:gitclonehttps://github.com/tusharsadhwani/json5kitcdjson5kitSetup a virtual environment:virtualenvvenv
.venv/bin/activateDo an editable install of the project, that way you don't have to keep
reinstalling:pipinstall-rrequirements-dev.txtRun tests:pytestRun type checking:mypy.
Package: jSona
jSonaJSON Format handler with bulit-in json moduleError tolerances are added to bulit-in json module.Because those kind of works are really annoying.Installationpip3 install jSona-master/ProjectsjSona have two major functionsload : Loads data from json format file.save : Saves to json format file.loads, dumps : Equals loads and dumps functions in json module.ExamplesScript# from jSona import save, loadfrompprintimportpprintasppfromjSonaimportsave,loadsample_data={'hello':['world','everyone~']}save("sample.json",sample_data,cry=True)load_data=load("sample.json",cry=True)pp(load_data)OutputsSAVESUCCESSTO[sample.json]LOADSUCCESSFROM[sample.json]{'hello':['world','everyone~']}NoticesUnauthorized distribution and commercial use are strictly prohibited without the permission of the original author and the related module.
Package: jsonabc
JSONABCJson Abstract Base ClassJSONABC is a minimal, pythonic JSON to class serializer. It haszerodependencies which makes it very lightweight. It provide a very minimal API with few options and play nicely with python type checking.InstallpipinstalljsonabcExamplesexample 1 (simple)fromjsonabcimportJSONABC# All you need to do is define JSONABC as your metaclassclassResponse(metaclass=JSONABC):args:dictheaders:dictorigin:strurl:strresp=requests.get("https://httpbin.org/get")json_data=resp.json()# Your class can now take a single dict and automatically validate and parse it.obj=Response(response)# obj attributes now have their correspondent values from our json data.# you can also convert your class back to its json form.# JSONABC will preserve the same names for the original json keys.print(obj.json())example 2 (composite)fromjsonabcimportJSONABC# You can also define composite values instead of using dictsclassHeaders(metaclass=JSONABC):accept:straccept_encoding:strclassResponse(metaclass=JSONABC):args:dictheaders:Headersorigin:strurl:strresp=requests.get("https://httpbin.org/get")json_data=resp.json()obj=Response(response)# headers attr is now an instance of Headers with the same behavior as Responseobj.headers
Package: jsonable
This library provides and abstract base classJSONablewhich enables easy definition of trivially JSON-able python objects.Installation:pip install jsonableExample:>>> import jsonable
>>>
>>>
>>> class Fruit(jsonable.Type):
...     __slots__ = ('type', 'weight')
...
...     def initialize(self, type, weight):
...         self.type   = str(type)
...         self.weight = float(weight)
...
>>> class Pie(jsonable.Type):
...     __slots__ = ('fruit',)
...
...     def initialize(self, fruit):
...         self.fruit = [Fruit(f) for f in fruit]
...
...
>>> pie = Pie([Fruit('apple', 10.3), Fruit('cherry', 2)])
>>>
>>> doc = pie.to_json()
>>> doc
{'fruit': [{'weight': 10.3, 'type': 'apple'}, {'weight': 2.0, 'type': 'cherry'}]}
>>>
>>> pie == Pie(doc)
True
Package: jsonable-objects
jsonable-objectsJSON-able objectsQuick introduction(WIP)Development environmentTo setup development environment:virtualenv -p python2.7 .
bin/pip install -U setuptools pip pip-tools
make
make testChanges0.1.5 (2018-11-11)typed mapping/sequence proxy.0.1.4 (2018-11-04)full field validation in__init__of the proxy classes.loose field setting restriction if a format is given.0.1.3 (2018-11-04)Add attr-like decorator.0.1.2 (2018-10-31)AddJsonableProxy.__repr__()0.1.1 (2018-10-31)Correct COPYING files.0.1.0 (2018-10-31)Initial release.
Package: jsonable-platform
jsonable-platformPipy package for customizing convert to JSON[!Important]
This package is still Beta, pleaseDO NOTuse it in production environment![!NOTE]
如果多语言文件与 中文 (简体) 冲突或差异, 以 中文 (简体) 为准If multi-language files conflict or different from Chinese (Simplified), in Chinese (Simplified), prevailPlease choose your language which you want to readzh-CN, 中文 (简体), Chinese
Package: jsonabler
jsonablerPython package for making your classes easy encodable to JSON string and vice-versa.Getting startedRequirementsPython >= 3.8InstallationpipinstalljsonablerUsageMaking a JsonableMake your class extends theJsonableinterface and implementsget_jsonable_dataandfrom_jsonable_datamethods with the encoding/decoding logic.fromjsonablerimportJsonable,jsonabled@jsonabledclassFoo(Jsonable):def__init__(self,bar:str):self.__bar=bardefget_jsonable_data(self)->dict:return{'bar':self.__bar,}@classmethoddeffrom_jsonable_data(cls,data:dict)->Jsonable:returncls(data['bar'])Registering a JsonableFor decoding your Jsonable classes, you need to register it.Decorating your classes with the@jsonableddecoratorfromjsonablerimportJsonable,jsonabled@jsonabledclassFoo(Jsonable):...Callingregister_jsonablesmethod passing class typesfromjsonablerimportJsonable,register_jsonablesclassFoo(Jsonable):...if__name__=='__main__':register_jsonables({Foo})Encoding a JsonableCalldumpsmethod passing aJsonableobject.fromjsonablerimportdumpsdefupload_foo(foo:Foo)->None:json_string=dumps(foo)# transmit your JSON string...Encoded Foo[
  'Foo',
  {
    'bar': "abc",
  }
]Decoding a JsonableCallloadsmethod passing the JSON string.fromjsonablerimportloads,JsonableDecodeError,JsonableNotRegisteredErrorfromjsonimportJSONDecodeErrordefdownload_foo()->Foo:# receive JSON string encoded Foo object...try:returnloads(json_string)# not a valid encoded JSON stringexceptJSONDecodeError:...# the Jsonable type of the encoded object was not registeredexceptJsonableNotRegisteredError:...# something went wrong while decoding the objectexceptJsonableDecodeError:...LicenseDistributed under the MIT License. SeeLICENSEfile for more information.
Package: jsonablr
JsonAblrJsonAblr is a Python library that allows you to encode variables into a format that represents a JSON object. It provides a simple and intuitive way to convert variables into a JSON-like structure, making it easier to store and transmit data.This was heavily inspired by FastAPI'sjsonable_encoder.JsonAblr now requires Pydantic 2.0 or above. If you are using Pydantic 1.x, please use JsonAblr 1.1.1.FeaturesEncode variables into a JSON-like formatSupports various data types including strings, numbers, lists, dictionaries, dates, Pydantic models, dataclasses and moreEasy to useCustomizable for your own typesInstallationYou can install Jsonablr using pip:pipinstalljsonablrUsageencodehelper function:fromjsonablrimportencodefromdatetimeimportdatetime,timezonemy_date=datetime.now(tz=timezone.utc)print(encode(my_date))Output:2023-06-26T12:30:00.000ZJsonAblrclass:fromtypingimportSetfromdatetimeimportdatetimefromjsonablrimportJsonAblrfrompydanticimportBaseModelclassDynamoDbItem(BaseModel):partition_key:strsort_key:strgames:Set[str]when:datetimeencoder=JsonAblr(encoders={datetime:lambdax:x.isoformat(sep=' ',timespec='seconds')},preserve_set=True)item=DynamoDbItem(partition_key='foo',sort_key='bar',games=['minecraft','terraria'],when=datetime.now())print(encoder.encode(item))This example demonstrates using a Pydantic model to be used as AWS DynamoDB item and not to be used as JSON. Thegamesattribute is returned as a set (when using thepreserve_set=Trueoption) to support the DynamoDB SET type.
Serialising a set withjson.dumpswill cause an error.Output:{
    'partition_key': 'foo',
    'sort_key': 'bar',
    'games': {'minecraft', 'terraria'},
    'when': '2023-06-26 12:30:00'
}
Package: jsonalias
jsonaliasA microlibrary that defines aJsontype alias for Python.This README is longer than the librarySeriously, this is all the code:fromtypingimportDict,List,UnionJson=Union[Dict[str,"Json"],List["Json"],str,int,float,bool,None]If we only supported Python >= 3.10, it would fit on one line:Json=dict[str,'Json']|list['Json']|str|int|float|bool|NoneThen why make a library out of it?I want to use this type alias in multiple projects and it's
just about long enough to be annoying.This alias should probably get added to the Pythontypingmodule.
If it does and I haven't put a big notice on this README,
please open a PR.ExamplefromjsonaliasimportJsond:Json={"foo":["bar",{"x":"y"}]}It's not working please help???Make sure you're using mypy >= 0.981 and running with the--enable-recursive-aliasesflag.Special ThanksGitHub user wbolster forthis commentnotifying us that mypy could now do JSON.
Package: json-analyze
json-analyzeA small tool to check JSON data for structural and data inconsistencies.Given this JSON object:{"a":[1,2,3,"hi"],"c":[123,2.34,"bye",[],{},{"a":123},{"a":null}]}Executingjson-analyze -f example.jsonwill display:Key       Type        Values    Distinct  Min           Max
--------  --------  --------  ----------  ------------  ------------
$         Dict             1           1  Dict(size=2)  Dict(size=2)
$.a       Iter             1           1  Iter(size=4)  Iter(size=4)
$.a[*]    int              3           3  1             3
          str              1           1  hi            hi
$.c       Iter             1           1  Iter(size=7)  Iter(size=7)
$.c[*]    float            1           1  2.34          2.34
          int              1           1  123           123
          Dict             3           2  Dict(size=0)  Dict(size=1)
          Iter             1           1  Iter(size=0)  Iter(size=0)
          str              1           1  bye           bye
$.c[*].a  NoneType         1           1
          int              1           1  123           123Developmentblack.
rm-rvdist/
pythonsetup.pysdistbdist_wheel
twineuploaddist/*
Package: json-and-data
json_and_data"dbify" JSON files, in PythonOpen source available onGitHubandPyPI.InstallationInstall from pip:py -m pip install json_and_dataUpdate to the latest version from pip:py -m pip install --upgrade json_and_dataUninstall from pip:py -m pip uninstall json_and_dataBuilding from sourcesRun this command from the package directory on your filesystem:py -m buildDevelopment diaryDEVDIARY.mdCommunityOpen a new issuefor
support.
Package: json-and-html
json_and_htmlA lightweight solution to converting JSON files into HTML tables, in PythonOpen source available onGitHubandPyPI.InstallationInstall from pip:py -m pip install json_and_htmlUpdate to the latest version from pip:py -m pip install --upgrade json_and_htmlUninstall from pip:py -m pip uninstall json_and_htmlBuilding from sourcesRun this command from the package directory on your filesystem:py -m buildUsageDrop your JSON files insrc/json_and_html/data/json/inputRunjson_and_html_core.pyas the main scriptRetrieve your HTML tables fromsrc/json_and_html/data/html/outputCommunityOpen a new issuefor
support.Special thanks toAddy- For the great patience and insights about Python importsStarDust- For the reciprocal help with Python
Package: json-and-merge
json_and_mergeA lightweight solution to validate and merge JSON files, in PythonOpen source available onGitHubandPyPI.InstallationInstall from pip:py -m pip install json_and_mergeUpdate to the latest version from pip:py -m pip install --upgrade json_and_mergeUninstall from pip:py -m pip uninstall json_and_mergeBuilding from sourcesRun this command from the package directory on your filesystem:Development diaryDEVDIARY.mdpy -m buildCommunityOpen a new issuefor
support.
Package: json-and-validation
json_and_validationA lightweight solution to validate JSON files and strings, in PythonOpen source available onGitHubandPyPI.InstallationInstall from pip:py -m pip install json_and_validationUpdate to the latest version from pip:py -m pip install --upgrade json_and_validationUninstall from pip:py -m pip uninstall json_and_validationBuilding from sourcesRun this command from the package directory on your filesystem:py -m buildCommunityOpen a new issuefor
support.
Package: json-any
InstallationThis project is published
on thePython Package Index (PyPI)at:https://pypi.org/project/json-any/.
It should be installable from Python distribution platforms or Integrated Development Environments (IDEs).
Otherwise, it can be installed from a command console usingpip:For all users (after acquiring administrative rights)For the current user (no administrative rights required)Installationpip installjson-anypip install--userjson-anyUpdatepip install--upgradejson-anypip install--user--upgradejson-anyDocumentationThe documentation is available athttps://src.koda.cnrs.fr/eric.debreuve/json-any/-/wikis/home.AcknowledgmentsThe project is developed withPyCharm Community.The development relies on several open-source packages
(seeinstall_requiresinsetup.py, if present; otherwiseimportstatements should be searched for).The code is formatted byBlack,The Uncompromising Code Formatter.The imports are ordered byisort…your imports, so you don’t have to.
Package: jsonapi
JSON-APIDjango module with json-api standard support.
It lets you easily add powerful api on top of your models and generate auto documentation.
Module is focused on simple integration allowing developers to add features later on.
Most of the functions would work out of the box.Compared to other solutions, this project does Django model introspection.
It allows to automatically query database using select_related/prefetch_related options for related resources.
No more configs, if you would like to include one resource into another, you are able to do that from client side.
Your client knows, when it needs it. Server in this case would perform db queries in a most efficient way.DevelopmentThroughput GraphDocumentationLibrary:http://jsonapi.readthedocs.org/Api Specification:http://jsonapi.org/TODOI’m going to migrate backend ORM to peewee soon. During development I would support Django all the time.
Idea behind it is to unify framework, so it would be possible to use jsonapi with Tornado, Flask or Asyncio.
Package: json-api
JSON APIMake you focus on writting business logic code, just return dict data for API, or other Response directly.What you need to do is inherit the Magic class and overwrite several methods, then use method it provides to add route to your framework app.The key point is it's apimagic.json_api(view_func)wraps your logic code, then check the request data and reponse data.pip3 install json-apiUsage ExamplesSanic Frameworkimport os
from sanic import Sanic

from json_api.magic_sanic import MagicSanic

magic = MagicSanic()
app = Sanic()
magic.set_app(app)


async def index(request, name="world"):
    return {"hello": name}


async def register(request, name, email, password):
    password = password or generate_random_password()
    user = new_user(name, email, password)
    return user.to_dict()

async def get_user_information(request, name):
    user = get_user_by_name(name)
    if not user:
        return {'reason': 'not found'}, 404
    return user.to_dict()


magic.add_route("/", index)
magic.add_route("/api/user/register", register, methods=["POST"])
magic.add_route("/api/user/info", get_user_information)


if __name__ == "__main__":
    debug = bool(os.getenv("DEBUG"))
    app.run(host="0.0.0.0", port=8000, debug=debug)Django Examplefrom json_api.magic_django import MagicDjango
from .utils import JSONEncoder

magic = MagicDjango()
magic.encoder = JSONEncoder

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include([
        path('translate', magic.json_api(trans))
    ]))
]
Package: json-api-doc
This library provides ability to transform between normalized JSON API
(http://jsonapi.org/) documents and denormalized Python dictionary object for
easier manipulation in code.
Also available as a command line utility and Python 3 module.DeserializationFor this JSON API document:{"data":[{"type":"articles","id":"1","attributes":{"title":"JSON API paints my bikeshed!","body":"The shortest article. Ever.","created":"2015-05-22T14:56:29.000Z","updated":"2015-05-22T14:56:28.000Z"},"relationships":{"author":{"data":{"id":"42","type":"people"}}}}],"included":[{"type":"people","id":"42","attributes":{"name":"John","age":80,"gender":"male"}}]}The simplified version will be:[{"type":"articles","id":"1","title":"JSON API paints my bikeshed!","body":"The shortest article. Ever.","created":"2015-05-22T14:56:29.000Z","updated":"2015-05-22T14:56:28.000Z","author":{"type":"people","id":"42","name":"John","age":80,"gender":"male"}}]SerializationTo turn an dict into JSON API specification document the root of your object
must contain a$typekey with a value corresponding to the name of
the object’s resource type. Any sub-dict or sub-array of dicts that also
contain a$typekey will be considered an included documents and serialized
accordingly.[{"$type":"articles","id":"1","title":"JSON API paints my bikeshed!","body":"The shortest article. Ever.","created":"2015-05-22T14:56:29.000Z","updated":"2015-05-22T14:56:28.000Z","author":{"$type":"people","id":"42","name":"John","age":80,"gender":"male"}}]{"data":[{"type":"articles","id":"1","attributes":{"title":"JSON API paints my bikeshed!","body":"The shortest article. Ever.","created":"2015-05-22T14:56:29.000Z","updated":"2015-05-22T14:56:28.000Z"},"relationships":{"author":{"data":{"id":"42","type":"people"}}}}],"included":[{"type":"people","id":"42","attributes":{"name":"John","age":80,"gender":"male"}}]}Usage as python moduleimportjson_api_docdocument={'data':{'type':'article','id':'1','attributes':{'name':'Article 1'}}}json_api_doc.deserialize(document)importjson_api_docdocument={'$type':'article','id':'1','name':'Article 1'}json_api_doc.serialize(document)Usage as cli$jsonapidocdocument.jsonContributorsJulien Duponchelle (https://github.com/noplay)Antonio Martinović (https://github.com/TopHatCroat)Jeff Zellman (https://github.com/jzellman)Brenda Deely (https://github.com/brendadeely)Taylor Hobbs (https://github.com/TayHobbs)LicenceFree software: Apache Software License 2.0DocumentationFull Documentation is available:https://json-api-doc.readthedocs.io.