Skip to main content

Automatic json parsing and serialing

Project description

jfjson

Build

Just fucking json!

Converts json to python objects using type annotations.

@dataclass
class Record:
    name: str
    pos: int
    age: float

jfjson.loads('[{"name": "you", "pos": 42, "age": 5.2}]', List[Record])
# [Record(name='you', pos=42, age=5.2)]

It also does data validation and type checking

jfjson.loads('["a", null, 12]', List[Optional[str]])
# jfjson.core.JsonConversionError: Found <class 'int'>, but was expecting typing.Optional[str]: at location .[2]

Also knows how to write any class that has a __dict__ attribute or _asdict() function.

@dataclass
class Record:
    name: str
    pos: int
    age: float

jfjson.dumps([Record(name='you', pos=42, age=5.2)])
# '[{"name": "you", "pos": 42, "age": 5.2}]'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jfjson-0.0.3.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jfjson-0.0.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file jfjson-0.0.3.tar.gz.

File metadata

  • Download URL: jfjson-0.0.3.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for jfjson-0.0.3.tar.gz
Algorithm Hash digest
SHA256 533b688e25678687d4fd7744c711c041cd887b5cc8084866312945dd193fecc5
MD5 efd79e733ee13acc37129b06b4077a6b
BLAKE2b-256 97e8bd49761736e0e2fec402b8b224504b9c52ea87db32551f37046cd4c32c3f

See more details on using hashes here.

File details

Details for the file jfjson-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: jfjson-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for jfjson-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 982b7d84e3b3ee58b6bc279ffdd152f2e1a99e6f729b986cf185c3970c6e849b
MD5 17e80e9cba4cc28d3885d84f4f26bf4d
BLAKE2b-256 0f94d926bfdecc4c36f7c4c31aec3723f1db0b44107405ac6da71bf15411465b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page