Package to Encode/Decode some common file formats to json

Related tags

JSONZnJSON
Overview

ZnJSON

Package to Encode/Decode some common file formats to json

Available via pip install znjson

In comparison to pickle this allows having readable json files combined with some serialized data.

Example

import numpy as np
import json
import znjson

znjson.register(
    znjson.converter.NumpyConverter
)

data = json.dumps({"data": np.arange(9)}, cls=znjson.ZnEncoder)
_ = json.loads(data, cls=znjson.ZnDecoder)
Comments
  • Allow to use converters directly

    Allow to use converters directly

    Currently you have to do:

    znjson.config.register(CustomConverter)
    json.dump(data, cls=znjson.ZnEncoder)
    

    but maybe you only want to use a specific converter which could look something like:

    json.dump(data, cls=znjson.ZnEncoder.from_converter(CustomConverter, allow_default=True)) # this could be a list of converters
    # or
    json.dump(data, cls=CustomConverter) # this would allow only one converter
    
    opened by PythonFZ 0
  • replace `_decode` with `decode`

    replace `_decode` with `decode`

    • replace _decode/_encode with decode/encode to avoid private methods. keep backwards compatibility.
    • move znjson.register to znjson.config.register
    • add logging
    • rename np.ndarray64 to np.ndarray_b64 to avoid confusion with 64 bit accuracy
    • add dev dependencies
    • add depreciation warnings
    • remove NumpyConverterLatin1
    • fix most circular import issues
    • remove pandas converter, because it uses pickle anyway
    opened by PythonFZ 0
  • check uniquness of representation string when calling register

    check uniquness of representation string when calling register

    It is currently possible to register two converters with the same representation: str which can be avoided by checking for uniqueness in the register command..

    opened by PythonFZ 0
  • generalize serializing scheme

    generalize serializing scheme

    To avoid issues when e.g. de-serializing a dict {"Path": "this is some string"} which should return a dict and not a Path object, it would be possible to serialize all objects to the dict {<type>: val} which would yield{"dict": {"Path": "this is some string"}} and therefore can not be confused with {"Path": "this is some string"}.

    opened by PythonFZ 0
  • Bump certifi from 2022.9.24 to 2022.12.7

    Bump certifi from 2022.9.24 to 2022.12.7

    Bumps certifi from 2022.9.24 to 2022.12.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(v0.2.1)
  • v0.2.1(Oct 4, 2022)

    What's Changed

    • add old converters for backwards compatibility by @PythonFZ in https://github.com/zincware/ZnJSON/pull/19
    • Allow to use converters directly by @PythonFZ in https://github.com/zincware/ZnJSON/pull/18

    Full Changelog: https://github.com/zincware/ZnJSON/compare/v0.2.0...v0.2.1

    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Oct 4, 2022)

    What's Changed

    • Use poetry + add exceptions by @PythonFZ in https://github.com/zincware/ZnJSON/pull/15
    • replace _decode with decode by @PythonFZ in https://github.com/zincware/ZnJSON/pull/16

    Full Changelog: https://github.com/zincware/ZnJSON/compare/v0.1.2...v0.2.0

    Source code(tar.gz)
    Source code(zip)
  • v0.1.2(Mar 11, 2022)

    What's Changed

    • Change version to be published on PyPi
    • add datetime example by @PythonFZ in https://github.com/zincware/ZnJSON/pull/13

    Full Changelog: https://github.com/zincware/ZnJSON/compare/v0.1.0...v0.1.2

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Mar 10, 2022)

    ZnJSON v0.1.0

    ⚙️New Features

    • changed license to Apache-2.0 License
    • improve numpy converter
    • increase code coverage
    • remove unused code
    • add class converter via pickle

    What's Changed

    • add base64 converter by @PythonFZ in https://github.com/zincware/ZnJSON/pull/6
    • Fix for new release by @PythonFZ in https://github.com/zincware/ZnJSON/pull/10
    • Add tests by @PythonFZ in https://github.com/zincware/ZnJSON/pull/11
    • Add class conv by @PythonFZ in https://github.com/zincware/ZnJSON/pull/5

    Full Changelog: https://github.com/zincware/ZnJSON/compare/v0.0.5...v0.1.0

    Source code(tar.gz)
    Source code(zip)
  • v0.0.5(Jan 19, 2022)

    What's Changed

    • bugfix by @PythonFZ in https://github.com/zincware/ZnJSON/pull/8

    Full Changelog: https://github.com/zincware/ZnJSON/compare/v0.0.4...v0.0.5

    Source code(tar.gz)
    Source code(zip)
  • v0.0.4(Jan 10, 2022)

    What's Changed

    • add pickle for class conversion by @PythonFZ in https://github.com/zincware/ZnJSON/pull/3

    Full Changelog: https://github.com/zincware/ZnJSON/compare/v0.0.3...v0.0.4

    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Dec 6, 2021)

    Rename package from ZnConv to ZnJSON to avoid misconception about convolutional neural networks

    Full Changelog: https://github.com/zincware/ZnJSON/compare/v0.0.2...v0.0.3

    Source code(tar.gz)
    Source code(zip)
  • v0.0.2(Dec 5, 2021)

  • v0.0.1(Dec 5, 2021)

Owner
ZINC
Open source software organisation hosting software built for computational physics and chemistry.
ZINC
API that provides Wordle (ES) solutions in JSON format

Wordle (ES) solutions API that provides Wordle (ES) solutions in JSON format.

Álvaro García Jaén 2 Feb 10, 2022
json|dict to python object

Pyonize convert json|dict to python object Setup pip install pyonize Examples from pyonize import pyonize

bilal alpaslan 45 Nov 25, 2022
Small python wrapper around the valico rust library to provide fast JSON schema validation.

Small python wrapper around the valico rust library to provide fast JSON schema validation.

Simon J Knibbs 5 Jul 12, 2019
The ldap2json script allows you to extract the whole LDAP content of a Windows domain into a JSON file.

ldap2json The ldap2json script allows you to extract the whole LDAP content of a Windows domain into a JSON file. Features Authenticate with password

Podalirius 68 Dec 07, 2022
Marshall python objects to and from JSON

Pymarshaler - Marshal and Unmarshal Python Objects Disclaimer This tool is in no way production ready About Pymarshaler allows you to marshal and unma

Hernan Romer 9 Dec 20, 2022
JsonParser - Parsing the Json file by provide the node name

Json Parser This project is based on Parsing the json and dumping it to CSV via

Ananta R. Pant 3 Aug 08, 2022
A Python tool that parses JSON documents using JsonPath

A Python tool that parses JSON documents using JsonPath

8 Dec 18, 2022
Creates fake JSON files from a JSON schema

Use jsf along with fake data generators to provide consistent and meaningful fake data for your system.

Andy Challis 86 Jan 03, 2023
Generate code from JSON schema files

json-schema-codegen Generate code from JSON schema files. Table of contents Introduction Currently supported languages Requirements Installation Usage

Daniele Esposti 30 Dec 23, 2022
Python script to extract news from RSS feeds and save it as json.

Python script to extract news from RSS feeds and save it as json.

Alex Trbznk 14 Dec 22, 2022
A fast JSON parser/generator for C++ with both SAX/DOM style API

A fast JSON parser/generator for C++ with both SAX/DOM style API Tencent is pleased to support the open source community by making RapidJSON available

Tencent 12.6k Dec 30, 2022
Ibmi-json-beautify - Beautify json string with python

Ibmi-json-beautify - Beautify json string with python

Jefferson Vaughn 3 Feb 02, 2022
JSON Interoperability Vulnerability Labs

JSON Interoperability Vulnerability Labs Description These are the companion labs to my research article "An Exploration of JSON Interoperability Vuln

Bishop Fox 168 Dec 25, 2022
Simple Python Library to convert JSON to XML

json2xml Simple Python Library to convert JSON to XML

Vinit Kumar 79 Nov 11, 2022
jq for Python programmers Process JSON and HTML on the command-line with familiar syntax.

jq for Python programmers Process JSON and HTML on the command-line with familiar syntax.

Denis Volk 3 Jan 09, 2022
A JSON API for returning Godspeak sentences. Based on the works of Terry A Davis (Rest in Peace, King)

GodspeakAPI A simple API for generating random words ("godspeaks"), inspired by the works of Terrence Andrew Davis (Rest In Peace, King). Installation

Eccentrici 3 Jan 24, 2022
simplejson is a simple, fast, extensible JSON encoder/decoder for Python

simplejson simplejson is a simple, fast, complete, correct and extensible JSON http://json.org encoder and decoder for Python 3.3+ with legacy suppo

1.5k Jan 05, 2023
JSON for Modern C++ Release Scripts

JSON for Modern C++ Release Scripts Preparations Install required tools: make install_requirements. Add required keys to config.json (apparently not c

Niels Lohmann 4 Sep 19, 2022
No more boilerplate to check and build a Python object from JSON.

JSONloader This module is for you if you're tired of writing boilerplate that: builds a straightforward Python object from loaded JSON. checks that yo

3 Feb 05, 2022
Simple, minimal conversion of Bus Open Data Service SIRI-VM data to JSON

Simple, minimal conversion of Bus Open Data Service SIRI-VM data to JSON

Andy Middleton 0 Jan 22, 2022