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
MOSP is a platform for creating, editing and sharing validated JSON objects of any type.

MONARC Objects Sharing Platform Presentation MOSP is a platform for creating, editing and sharing validated JSON objects of any type. You can use any

CASES Luxembourg 72 Dec 14, 2022
Random JSON Key:Pair Json Generator

Random JSON Key:Value Pair Generator This simple script take an engish dictionary of words and and makes random key value pairs. The dictionary has ap

Chris Edwards 1 Oct 14, 2021
Roamtologseq - A script loads a json export of a Roam graph and cleans it up for import into Logseq

Roam to Logseq The script loads a json export of a Roam graph and cleans it up f

Sebastian Pech 4 Mar 07, 2022
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
A tools to find the path of a specific key in deep nested JSON.

如何快速从深层嵌套 JSON 中找到特定的 Key #公众号 在爬虫开发的过程中,我们经常遇到一些 Ajax 加载的接口会返回 JSON 数据。

kingname 56 Dec 13, 2022
cysimdjson - Very fast Python JSON parsing library

Fast JSON parsing library for Python, 7-12 times faster than standard Python JSON parser.

TeskaLabs 235 Dec 29, 2022
Convert your JSON data to a valid Python object to allow accessing keys with the member access operator(.)

JSONObjectMapper Allows you to transform JSON data into an object whose members can be queried using the member access operator. Unlike json.dumps in

Owen Trump 4 Jul 20, 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
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
JSONManipulator is a Python package to retrieve, add, delete, change and store objects in JSON files.

JSONManipulator JSONManipulator is a Python package to retrieve, add, delete, change and store objects in JSON files. Installation Use the package man

Andrew Polukhin 1 Jan 07, 2022
Convert Wii UI formats to JSON5 and vice versa

Convert Wii UI formats to JSON5 and vice versa

Pablo Stebler 11 Aug 28, 2022
Wikidot-forum-dump - Simple Python script that dumps a Wikidot wiki forum into JSON structures.

wikidot-forum-dump Script is partially based on 2stacks by bluesoul: https://github.com/scuttle/2stacks To dump a Wiki's forum, edit config.py and put

ZZYZX 1 Jun 29, 2022
Fileson - JSON File database tools

Fileson is a set of Python scripts to create JSON file databases

Joonas Pihlajamaa 2 Feb 02, 2022
A Python application to transfer Zeek ASCII (not JSON) logs to Elastic/OpenSearch.

zeek2es.py This Python application translates Zeek's ASCII TSV logs into ElasticSearch's bulk load JSON format. For JSON logs, see Elastic's File Beat

Corelight, Inc. 28 Dec 22, 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
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
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
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
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
Simple Python Library to convert JSON to XML

json2xml Simple Python Library to convert JSON to XML

Vinit Kumar 79 Nov 11, 2022