Saravanan666/pypi-org huggingface dataset:
Package: jsonc2json
jsonc2jsonpython & rust package to strip comments from jsonc strings/bytesuses:https://docs.rs/json_comments/latest/json_comments/Install:pipinstalljsonc2jsonUsage:fromjsonc2jsonimportjsonc2jsonjsonc_string="""{"name": /* full */ "John Doe","age": 43,"phones": ["+44 1234567", // work phone"+44 2345678"  // home phone]  # hash comment}""".strip()json_string=jsonc2json(jsonc_string)print(json_string)# PRINTS:# {#     "name":            "John Doe",#     "age": 43,#     "phones": [#         "+44 1234567",#         "+44 2345678"#     ]# }assertisinstance(json_string,str)assertisinstance(jsonc2json(jsonc_string.encode()),bytes)CLI# stdin$echo'{"a": 1 /* comment */, "b": 2}'|python-mjsonc2json'{"a": 1              , "b": 2}'# file (still stdin!)$python-mjsonc2json<has-comments.jsonc>no-comments.jsonTODO:Add options present in the rust packageClap CLI?build confit
Package: jsoncanon
jsoncanonTyped Python implementation of JSON Canonicalization Scheme as described inRFC 8785. The initial release (v0.2.x) is a partial release focused on the
features needed by theSequence Collections working groupin theGlobal Alliance for Genomics and Health (GA4GH).Usage>>> import json
>>> from jsoncanon import canonicalize
>>>
>>> data = json.loads('{ "b": [1,3,7], "a": { "y": true, "x": null } }')
>>> canonicalize(data)
b'{"a":{"x":null,"y":true},"b":[1,3,7]}'Releasesv0.2.0 - Initial release, supporting all data types except for floating point numbers
v0.2.1 - Yanked due to incorrect link
v0.2.2 - Initial release with updated project information
Package: json-canonical
This is a Python package for a JCS (RFC 8785) compliant canonicalizer. The source code is taken fromPython2 folder from this repo.The main author of this code isAnders Rundgren. I have forkedhis repoand ported Python3 code to Python 2.7.Installationpipinstalljson-canonicalUsing the JSON canonicalizerfromjson_canonicalimportcanonicalizedata=canonicalize({"tag":4})
Package: jsoncatalogue
Packagejsoncatalogueallows reading set of JSON files from directory structure resembling urls.Files are loaded and provided as simple url: jsoncontent dictionary.Such a dictionary can be used as catalogue of JSON schemas for JSON Schema validation.Installation$ pip install jsoncatalogueStructure of directory with JSON filesIf you want to have catalogue for Swagger v1.2 validation:./catalogue/http/wordnik.github.io/schemas/v1.2/apiDeclaration.json
./catalogue/http/wordnik.github.io/schemas/v1.2/infoObject.json
./catalogue/http/wordnik.github.io/schemas/v1.2/authorizationObject.json
./catalogue/http/wordnik.github.io/schemas/v1.2/modelsObject.json
./catalogue/http/wordnik.github.io/schemas/v1.2/operationObject.json
./catalogue/http/wordnik.github.io/schemas/v1.2/parameterObject.json
./catalogue/http/wordnik.github.io/schemas/v1.2/dataTypeBase.json
./catalogue/http/wordnik.github.io/schemas/v1.2/oauth2GrantType.json
./catalogue/http/wordnik.github.io/schemas/v1.2/resourceObject.json
./catalogue/http/wordnik.github.io/schemas/v1.2/dataType.json
./catalogue/http/wordnik.github.io/schemas/v1.2/resourceListing.jsonwherecatalogue- is catalogue “home” directory (can be deeper)http- is protocol name. Can be any other, likeftp…wordnik.github.io- domain nameschemas/v1.2- local path to JSON filesapiDeclaration.json- actual JSON file - must be valid JSON file (no other requirement exist)As you see, there are no complex rules to follow, just have uri leading to valid JSON file (which is not even required to have an extension “.json”)Loading JSON Catalogue from directory>>> from jsoncatalogue import Catalogue
>>> catalogue = Catalogue()
>>> catalogue.add_directory("catalog")
>>> catalogue.add_directory("../other/catalog")
>>> catalogue.store
{"http://exam.ple/schema/one.json": {...},
 "http://exam.ple/schema/two.json": {...},
 "http://wordnik.github.io/schema/v1.2/apiAuthentication.json": {...}
 "http://no.extensi.on/schema/pets": {...}
 }And this is all. You now have a dictionary with uris and related JSON content. The JSON content is already loaded and is represented as dictionary.Using catalogue for JSON Schema validatorThis catalogue.store can be assigned e.g. tojsonschemavalidator:>>> from jsonschema import Draft4Validator
>>> validator = Draft4Validator()
>>> validator.resolver.store = catalogue.storeFrom now on, validator will know about schemas from catalogueNoteInitial development done during work forCDVon projectSUPERHUB. The package is published under MIT license with permision ofCDV.
Package: jsoncf
jsoncfprettify json string from clipboardGithub repository:https://github.com/idlewith/jsoncf/Documentationhttps://idlewith.github.io/jsoncf/InstallpipinstalljsoncfUsagethe json string below{"employees":[  {"name":"Shyam", "email":"shyamjaiswal@gmail.com"},  {"name":"Bob", "email":"bob32@gmail.com"},  {"name":"Jai", "email":"jai87@gmail.com"}  ]}you can select the whole json string, then typeCtrl(Cmd) + Cto copy,then just type the commandjsoncfORyou can use it as argsjsoncf'{"employees":[  {"name":"Shyam", "email":"shyamjaiswal@gmail.com"},  {"name":"Bob", "email":"bob32@gmail.com"},  {"name":"Jai", "email":"jai87@gmail.com"}  ]} 'the output below{"employees":[{"name":"Shyam","email":"shyamjaiswal@gmail.com"},{"name":"Bob","email":"bob32@gmail.com"},{"name":"Jai","email":"jai87@gmail.com"}]}andjsoncfalso write json data todata.jsonin current path
Package: jsonchecker
Checks a JSON file for any duplicate keys, which would be ignored by the normal
parser.Inspired by and based off of a python-list mailing list post:
<https://mail.python.org/pipermail/python-list/2013-May/660874.html>.Dependencies:Python 2.7 or Python 3Installation:pip install jsoncheckerOr:git clonehttps://github.com/legoktm/jsonchecker.git&& cd jsonchecker && python setup.py installUsage:jsonchecker file_to_validate.jsonjsonchecker directory/of/json/files/An optional--quietargument can be passed, and will cause the script to print out a.instead
of the full filename for each file scanned. Useful if you plan on checking a large number of files.The script will exit with a status code of 1 if any duplicate keys are found,
0 if none are.An optional--valuesargument can be passed to additionally check for duplicate values within each key.
The script will exit with a status code of 1 if there are either duplicate keys or duplicate values are found,
0 if none are.Released into the public domain.
Package: jsonchick
JSONCHICKGet paths to a value in JSON data.Installpip install jsonchickUsefrom jsonchick import jsonchick


data = [{'k1': 'v1'}, [{'k2': ['v1']}]]
value = 'v1'

assert ((0, 'k1'), (1, 0, 'k2', 0)) == jsonchick.get_tuples(value, data)
assert [[0, 'k1'], [1, 0, 'k2', 0]] == jsonchick.get_lists(value, data)
assert ['[0]["k1"]', '[1][0]["k2"][0]'] == jsonchick.get_strings(value, data)CreditsThe lib is a modified version of a Stackoverflow answer on the question:https://stackoverflow.com/questions/31010299/json-get-key-path-in-nested-dictionary
Package: jsonclass
JSONClassConvert json to object and back in Python.Examplefrom jsonclass import JSONClass


class Test(JSONClass):
    field: str


obj = Test()
obj.field = "value"
assert obj.to_json()["field"] == "value"

obj = JSONClass({"__json_class__": "Test", "field": "value2"})
assert isinstance(obj, Test)
assert obj.field = "value2"
Package: jsonclasses
🌎 JSONClassesJSONClasses is a declarative data flow pipeline and data graph framework.Official Website:https://www.jsonclasses.comOfficial Documentation:https://docs.jsonclasses.com🚗 FeaturesFeatures🛠Data ModelingDeclarative data model with Python type hints🍸Data SanitizationTwo strictness modes🩺Data ValidationDescriptive data validation rules without even a line of code🧬Data TransformationIntuitive with modifier pipelines🦖Data PresentationCustom key encoding & decoding strategies🌍Data GraphingModels are linked with each other on the same graph🏄‍♂️Data QueryingWell-designed protocols and implementations for databases🚀Synthesized CRUDOnly with a line of code👮‍♀️Session & AuthorizationBuiltin support for session and authorization🔐Permission SystemSupports both object level and field level📁File UploadingA configuration is enough for file uploading📦Data SeederDeclarative named graph relationship🍎 Getting StartedPrerequisitesPython >= 3.10is required. You can download ithere.Install JSONClassesInstall JSONClasses is simple withpip.pipinstalljsonclassesInstall ComponentsDepends on your need, you can install ORM integration and HTTP library integration with the following commands.pipinstalljsonclasses-pymongojsonclasses-server🎹 ExamplesBusiness Logic ExamplesExample 1: Dating App UsersLet's say, you are building the base user functionality for a cross-platform
dating app.The product requirements are:Unique phone number is requiredPassword should be secure, encrypted, hidden from responseGender cannot be changed after setThis product is adult onlyUser intro should be briefLet's transform the requirements into code.fromjsonclassesimportjsonclass,typesfromjsonclasses_pymongoimportpymongofromjsonclasses_serverimportapi@api@pymongo@jsonclassclassUser:id:str=types.readonly.str.primary.mongoid.requiredphone_no:str=types.str.unique.index.match(local_phone_no_regex).required#1email:str=types.str.match(email_regex)password:str=types.str.writeonly.length(8,16).match(secure_password_regex).transform(salt).required#2nickname:str=types.str.requiredgender:str=types.str.writeonce.oneof(['male','female'])#3age:int=types.int.min(18).max(100)#4intro:str=types.str.truncate(500)#5created_at:datetime=types.readonly.datetime.tscreated.requiredupdated_at:datetime=types.readonly.datetime.tsupdated.required⚽️ Database & HTTP Library IntegrationsJSON Classes PymongoThe mongodb integration through pymongo driver.JSON Classes ServerThe server integration.🦸 ContributingFile abug report. Be sure to include information like what version of YoMo you are using, what your operating system is, and steps to recreate the bug.Suggest a new feature.🤹🏻‍♀️ FeedbackAny questions or good ideas, please feel free to come to our Discussion. Any feedback would be greatly appreciated!LicenseMIT License
Package: json-clip
ClipThis is a simple command-line utility for managing a clipboard storage system. It allows users to add, retrieve, list, remove, and clear text entries stored in a JSON file. This utility supports both indexed and key-value storage, making it versatile for various use cases.FeaturesAdd Entries:Add text entries with or without a key.Get Entries:Retrieve entries by their index or key.List Entries:Display all entries, or filter by indexed or key-based entries.Remove Entries:Delete entries by their index or key.Clear Storage:Completely clear the storage or selectively by indexed or key-based entries.Commands and OptionsAddAdd a new entry to the storage. Entries can be added to indexed storage or associated with a specific key.Syntax:add [-k key] valueOptions:-k,--key: Specify a key for the entry (for key-value storage).Examples:Add to indexed storage:clip add "Sample text"Add to key-value storage:clip add -k sample "Sample text"GetRetrieve and display an entry from the storage.Syntax:get [-k key] indexOptions:-k,--key: Specify that the retrieval should use a key (for key-value storage).Examples:Get from indexed storage:clip get 0Get from key-value storage:clip get -k sampleList (ls)List entries stored in the clipboard.Syntax:ls [-a | -k]Options:-a,--all: List all entries (both indexed and key-value).-k,--key: List only key-value entries.Examples:List indexed entries:clip lsList all entries:clip ls -aList key-value entries:clip ls -kRemove (rm)Remove an entry from the storage.Syntax:rm [-k key] indexOptions:-k,--key: Specify that the removal should use a key (for key-value storage).Examples:Remove from indexed storage:clip rm 0Remove from key-value storage:clip rm -k sampleClearClear all entries from the storage or selectively clear indexed or key-value storage.Syntax:clear [-i | -k]Options:-i,--index: Clear only the indexed storage.-k,--key: Clear only the key-value storage.Examples:Clear all storage:clip clearClear indexed storage:clip clear -iClear key-value storage:clip clear -kHelpDisplay help information about all commands and options.Syntax:helpExample:clip help
Package: jsoncodable
jsoncodableDescriptionEasily create object from any dict/jsonstr/jsonfile and dict/jsonstr/jsonfile from any objectFrom v0.1.0 it is based onjsonpickleInstallpipinstalljsoncodable# orpip3installjsoncodableUsagefromjsoncodableimportJSONCodable,CompressionAlgorithmclassBirthDay(JSONCodable):def__init__(self,month:int,day:int):self.month=monthself.day=dayclassPerson(JSONCodable):def__init__(self,name:str,birth_month:int,birth_day:int):self.name=nameself.birth_day=BirthDay(birth_month,birth_day)person=Person(name='John',birth_month=7,birth_day=7)person.jsonprint()# prints## {#     "name": "John",#     "birth_day": {#         "month": 7,#         "day": 7#     }# }Person.load(person.json).jsonprint()# prints## {#     "name": "John",#     "birth_day": {#         "month": 7,#         "day": 7#     }# }importos# Save with compressionjson_file_path='test.json'forcinCompressionAlgorithm:compressed_file_path=person.save(json_file_path,compression=c)# returns a file path which has the compressed extension if not present at the end of your provided path# also prints a message to let you know, that the path had been modifiedPerson.load(compressed_file_path).jsonprint()# prints## {#     "name": "John",#     "birth_day": {#         "month": 7,#         "day": 7#     }# }# Cleaning upos.remove(compressed_file_path)Dependenciesjsonpickle,noraise
Package: json-codec
Json CodecIt's a simple library to encode and decode json to strict python types using dataclasses and builtin python types.Installationpipinstalljson-codec

poetryaddjson-codecUsageParse a simple primitive typefromjson_codecimportdecodeimportjsonassertdecode(json.loads("true"),bool)isTrueassertdecode(json.loads("false"),bool)isFalseassertdecode(json.loads("null"),Optional[bool])isNoneassertdecode(json.loads("1"),int)==1assertdecode(json.loads("1"),Decimal)==Decimal("1")assertdecode(json.loads('"1.1"'),Decimal)==Decimal("1.1")assertdecode(json.loads('"1.1"'),float)==1.1assertdecode(json.loads('"1.1"'),str)=="1.1"assertdecode(json.loads('[1,1]'),List[int])==[1,1]Parse a dataclassfromdataclassesimportdataclassfromjson_codecimportdecodeimportjson@dataclass(frozen=True)classUser:name:strage:intassertdecode({"name":"John","age":30},User)==User(name="John",age=30)@dataclassclassDummy:text_list:List[str]text_dict:Dict[str,Decimal]optional_text:Optional[str]dummy_json_text="""{"text_list": ["a", "b", "c"],"text_dict": {"a": 1.0,"b": 2,"c": "3.3","d": 2.2},"optional_text": "hello"}"""dummy_json=json.loads(dummy_json_text)parsed=decode(dummy_json,Dummy)assertparsed.text_list==["a","b","c"]assertparsed.text_dict["a"]==Decimal("1.0")assertparsed.text_dict["b"]==Decimal("2.0")assertparsed.text_dict["c"]==Decimal("3.3")assertparsed.text_dict["d"].quantize(Decimal("1.0"))==Decimal("2.2")assertparsed.optional_text=="hello"Parse a dataclass with a nested dataclassfromdataclassesimportdataclassfromjson_codecimportdecodeimportjson@dataclassclassNestedDummy:text:strnumber:Decimalboolean:bool@dataclassclassDummy:text_list:List[str]text_dict:Dict[str,Decimal]nested:NestedDummydummy_json_text="""{"text_list": ["a", "b", "c"],"text_dict": {"a": 1.0,"b": 2,"c": "3.3","d": 2.2},"nested": {"text": "hello","number": 1.1,"boolean": true}}"""dummy_json=json.loads(dummy_json_text)parsed=decode(dummy_json,Dummy)assertparsed.text_list==["a","b","c"]assertparsed.text_dict["a"]==Decimal("1.0")assertparsed.text_dict["b"]==Decimal("2.0")assertparsed.text_dict["c"]==Decimal("3.3")assertparsed.text_dict["d"].quantize(Decimal("1.0"))==Decimal("2.2")assertparsed.nested.text=="hello"assertparsed.nested.number.quantize(Decimal("1.0"))==Decimal("1.1")assertparsed.nested.booleanisTrueParse a newtypefromjson_codecimportdecodefromtypingimportNewTypeimportjsonUserId=NewType("UserId",int)assertdecode(json.loads("1"),UserId)==UserId(1)assertisinstance(decode(json.loads("1"),UserId),int)
Package: json-codegen
json-schema-codegenGenerate code from JSON schema files.Table of contentsIntroductionCurrently supported languagesRequirementsInstallationUsageCode generationPython3Python3+MarshmallowJavaScript+Flow and FlowContributeIntroductionThis is a command line tool to take ajson-schemafile and generate code automatically.For instance thisjson-schemadefinition:{"$schema":"http://json-schema.org/draft-04/schema#","title":"Test","type":"object","properties":{"id":{"type":"integer"}}}will generate this Python code:classTest(object):def__init__(self,data=None):data=dataor{}self.id=data.get("id")or this JavaScript+Flow code:exportclassTest{id:?number;constructor(data:Object={}){this.id=data.id;}}Currently this tool generates code for Python and JavaScript withFlowannotations but it can be extended to generate code for any language.The code generation is divided in two stages:generate theASTfor the target language from thejson-schemafileconvert the AST into the target languageThis allows the tool to be language agnostic, that is it just needs to generate the AST in JSON format for the target language and then a language specific tool will convert this AST into proper code.Currently supported languagesList of currently supported languages:Python 3.7+JavaScript ES7+ with Flow annotationspure Flow annotationsRequirementsPython 3.6 / 3.7Node v12InstallationUntil thispull requestinsetuptoolsis fixed, the only way to installjson-schema-codegenis to clone the repo:gitclonehttps://github.com/expobrain/json-schema-codegen.gitUsageusage:json_codegen.py[-h][--prefixPREFIX][--languageLANGUAGE][--outputOUTPUT]schema

positionalarguments:schemaDefinitionofthePRDasJSONschema

optionalarguments:-h,--helpshowthishelpmessageandexit--prefixPREFIX,-pPREFIXOptionalprefixforgeneratedclasses--languageLANGUAGE,-lLANGUAGEOutputlanguage.Defaultispython--outputOUTPUT,-oOUTPUTOutputfilenameforthegeneratedcodeCode generationPython 3The egenerator of pure Python 3 compatible code:json_codegen--languagepython3--output<output_py_file><json-schema>Python 3+MarshmallowThe generation of Python 3's code withMarshmallowsupport is integrated into the tool so it needs just a single invocation:json_codegen--languagepython3+marshmallow--output<output_py_file><json-schema>JavaScript+Flow and FlowGenerating JavaScript+Flow and Flow code involves two steps, generating the AST:json_codegen--language[javascript+flow|flow]--output<output_ast_json><json-schema>and generating the code from the AST:bin/ast_to_js<output_ast_json><output_js_file>
Package: json-coder
json-coder: Quickly serialize and deserialize python to json objectsThe default library pythonjsonmodule supports custom decoders and encoders
allowing for saving and restoring custom objects into json. In comparison to
pickling objects, this is more portable and easier to manually edit.This library supports the following use-cases:Class with json loading and dumping functions
(define.jsonproperty or.to_json()method for dumping, define.from_json()constructor or proper init for reading)pythondataclassclassescustom loading and dumping functions for classes defined elsewhereFundamentally classes are assigned an identifier and json objects of the
following structure are created:{
    '__<identifier>__': <object data>
}Usage examplesCustom class using predefined schema:import json
import json_coder

@json.jsonify("testclass")
class TestClass:
    def __init__(self, a: int):
        self.a = a

    def to_json(self):
        return {"a": self.a}


# Usage
a = json.loads('{"__testclass__": {"a": 10}}')

print(a)
# <__main__.TestClass object at 0x10eb26810>

print(json.dumps(a))
# {"__testclass__": {"a": 10}}Dataclasses do not require any additional methods to work properly.from dataclasses import dataclass
import json
import json_coder

@json_coder.jsonify("testdataclass")
@dataclass
class TestDataClass:
    a: int


a = json.loads('{"__testdataclass__": {"a": 10}}')
print(type(a))  # should now be an object of testdataclass
print(json.dumps(a))Custom dumper and reading functions can also be added to existing classes by
registering manually:import datetime
import json
import json_coder

json_coder.register("datetime", datetime.datetime, datetime.datetime.fromisoformat, datetime.datetime.isoformat)
d = json.loads('{"__datetime__": "2018-10-10"}')
print(d)
print(json.dumps(d))
Package: jsoncomment
Json CommentA wrapper to JSON parsers allowing comments, multiline strings and trailing commasDependenciesPython 3.3+TODO NEW ADDITIONSOptionalujson 1.30+DescriptionJSON Comment allows to parse JSON files or strings with:Single and Multi line commentsMulti line data stringsTrailing commas in objects and arrays, after the last itemThis package works with any JSON parser which supports:load(fp, ...)to parse filesloads(s, ...)to parse stringsby adding a preprocessor to these calls.Comments#,;and//are for single line comments/*and*/enclose multiline commentsInline comments arenotsupportedMultiline stringsAny string can be multiline, even object keys.Multiline strings start and end with""", like in pythonThe preprocessor merges all lines to a single JSON standard stringA single trailing space per line is kept, if presentNew line is not kept. To hard code new lines in the string, use\\nCustom MethodsFile Loadloadf(path, *args, default = None, **kwargs)Opens a JSON file with comments. Allows a default value if loading or parsing failsFile Savedumpf(json_obj, path, *args, indent=4, **kwargs)Saves a JSON file with indentationInstallpip install jsoncommentORDownload sourcepython setup.py installUsagefrom jsoncomment import JsonComment

string = "[]"
json = JsonComment()
json_obj = json.loads(string)ExamplesAdded in the /examples directoryLimitations#,;,//and/*may be preceded only by whitespaces or tabs on the same line*/may be followed only by whitespaces or tabs on the same lineThe trailing comma must be the last character on the same lineSourceSourcecode available with MIT license on Bitbucket.APIAdded in top level__init__.pyHow to read the APIAPI is split in:* `User Interface` for common use
* `Developer Interface` exposing some internals that could be usefulFor each item ( function or class ), there are 2 blocks of comments, above and below item definition:* The top describes the return values
* The bottom describes the item and call variablesIf call variables have defaults or use duck typing, every allowed value is describedExample:# return_value
	# description
from .some_module import SomeClass
	# SomeClass description
# (
	# variable_1,
		# description
	# variable_2 = something,
		# description

		# = Default
			# description of default value ( something )
		# = something_2
			# description of alternate form ( duck typing )
# )describesreturn_value = SomeClass(variable_1, variable_2 = current_value)ContactGaspare Iengo @email
Package: jsoncompare3
jsoncompare3 is a simple Python3 utility for comparing two JSON objectsUSAGE (recommand python version >= 3.6)python jsoncompare.py <item1> <item2>Where item1 and item2 are either a file or a url containing a JSON object. The compare() method can also be called as a library from other Python code, in which case item1 and item2 can also be dict or array objects.