Skip to main content

Build Status

Human JSON

human_json is a simple python library, that can take a JSON Object, and create a pretty string for that object.

JSON is easy to transport, and quite easy to read, but requires some form of prior training to properly understand it. This library allows one to transform JSON Objects into an easier to read format

Example

The following Python dictionary (which can represent a JSON Object):

{
    'className': 'ComputerScience',
    'classId': 2020,
    'assignments': {
        'assignment1': {
            'average_grade': 5.5,
            'description': 'Complete Assignment 1',
            'grades': [5, 5, 5, 7]
        },
        'assignment2': {
            'average_grade': None,
            'description': 'Complete Assignment 2',
            'grades': ()
        }
    },
    'students': ('student1', 'student2', 'studentabc', 2019, None, 10.5),
}

turns into the following pretty string:

className: ComputerScience
classId: 2020
assignments:
	assignment1:
		average_grade: 5.5
		description: Complete Assignment 1
		grades:
			5
			5
			5
			7
	assignment2:
		average_grade: None
		description: Complete Assignment 2
		grades:
			-
students:
	student1
	student2
	studentabc
	2019
	None
	10.5

Custom Prefixes

You can also specify an optional prefix, that will be prefixed to each line. A possible prefix is "* ". Using this prefix, will return a markdown list. This can be directly copy-pasted into a markdown file, for example:

* className: ComputerScience
* classId: 2020
* assignments:
	* assignment1:
		* average_grade: 5.5
		* description: Complete Assignment 1
		* grades:
			* 5
			* 5
			* 5
			* 7
	* assignment2:
		* average_grade: None
		* description: Complete Assignment 2
		* grades:
			* -
* students:
	* student1
	* student2
	* studentabc
	* 2019
	* None
	* 10.5

Custom Indentations

You can also specify a custom indentation. The default is "\t", but you can specify " " or even a number of spaces. Below is an example using 2:

className: ComputerScience
classId: 2020
assignments:
  assignment1:
    average_grade: 5.5
    description: Complete Assignment 1
    grades:
      5
      5
      5
      7
  assignment2:
    average_grade: None
    description: Complete Assignment 2
    grades:
      -
students:
  student1
  student2
  studentabc
  2019
  None
  10.5

Release files for human-json 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for human-json 0.3.0
File Size Uploaded
human-json-0.3.0.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for human-json 0.3.0
File Interpreter ABI Platform
human_json-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / human-json-0.3.0.tar.gz

Download URL human-json-0.3.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3d68a4f5a4797bf3eababf6057b1704249fff282d0b70f7fbed88726a4a7163e
BLAKE2b-256 checksum
How to use checksums
7c4f82bf84cc9f377d0051761112f8847f398fc25868909c28d9c50b6faec101
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.17 CPython/3.6.3 Linux/4.4.0-101-generic

Release files / human_json-0.3.0-py3-none-any.whl

Download URL human_json-0.3.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8751da13d0401ab9cd76c53ad7c1d9956b6f072981601ef9d884fff098cbae4
BLAKE2b-256 checksum
How to use checksums
5fac19718ece3e092dca5299e8da7353becf199714cdfb04b19b03d74ee223db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.17 CPython/3.6.3 Linux/4.4.0-101-generic

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page