Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

human-json

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

human-json

Transform JSON Objects to human readable strings

  • 0.3.0
  • PyPI
  • Socket score

Maintainers
1

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

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc