A Discord bot to easily and quickly format your JSON data

Overview

Screenshot 2021-09-27 at 21 54 16

Invite PrettyJSON to your Discord server

Table of contents

About the project

Since programming with other users on the group-chatting platform Discord has become very popular, its use in bots has also increased. Several bots have already been released to make programming together within a community or group easier. For example, we have bots to compile code or to keep track of GitHub commits. Since you can often find yourself in a position where you use JSON data in your code, it could be helpful if this data is neatly formatted, but unfortunately this is not always the case. Usually the easiest way to quickly format your JSON data is by using an online website where you would paste your text and it would format it very nicely for you. With the lazy mindset of mine, I thought that it would be way easier and more convenient if this could be done through a Discord bot as well. And well, here we are.

What is JSON?

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write, and it's easy for machines to parse and generate. Although JSON is derived from JavaScript, it is supported either natively or through libraries in most major programming languages. JSON is commonly, but not exclusively, used to exchange information between web clients and web servers. It is a generic data format with a minimal number of value types: strings, numbers, booleans, lists, objects, and null.

Example:

{
 "firstName": "Sem",
 "lastName": "Moolenschot",
 "student": true,
 "pets": [
   {
     "name": "Bo",
     "type": "Dog"
   }
 ]
}

What is pretty printing?

Pretty printing is a form of stylistic formatting including indentation and colouring. It's important to have your JSON file formatted so it's easier for humans to read. The only disadvantage of pretty printing your JSON is that the size of the data will slightly increase, but in most cases people choose to have it pretty printed anyway so your data remains easy to read for humans.

Example of non-pretty printed JSON:

{"firstName": "Sem", "lastName": "Moolenschot", "student": true, "pets": [{"name": "Bo", "type": "Dog"}]}

Previous example pretty printed using PrettyJSON:

{
 "firstName": "Sem",
 "lastName": "Moolenschot",
 "student": true,
 "pets": [
   {
     "name": "Bo",
     "type": "Dog"
   }
 ]
}

How to use

There are a few different ways to give the bot your non-pretty printed JSON as input. Once the input is received by the bot, it will be pretty printed and sent back to the user. Keep in mind that if you pretty print JSON via a message you are dealing with a 2000 character limit, unless you have a Discord Nitro membership then this limit will be 4000.

Input options:

  • TXT files
  • JSON files
  • JSON URL
  • Message

Command:

  • .pprint [input]

Example of a message as input:

Screenshot 2021-10-17 at 21 39 39

Example of a JSON file as input:

Screenshot 2021-10-17 at 21 39 39

If the output has less than 2000 characters, it will be sent back as text and a 📁 reaction will be added to the message. If you press this reaction, you will receive the output as a JSON file.

Installation

PrettyJSON is being hosted 24/7, so there is no need to worry about that. If you don't want to host yourself, but wish to use the bot in your Discord server, then please look at how to invite. But if you would like to host the bot yourself or make changes to the code, then you can check out the following steps.

  1. Clone the repository git clone https://github.com/semmoolenschot/PrettyJSON.git
  2. Install the requirements pip install -r requirements.txt
  3. Make sure to insert your own token in line 16 in bot.py
  4. Run the bot python3 bot.py

How to invite

  1. Go to PrettyJSON's invitation link
  2. Select the server where you would like to add the bot
  3. Make sure PrettyJSON has the right permissions
  4. Authorize

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Contact

[email protected]
Reddit
Instagram

License

Distributed under the MIT License. See LICENSE for more information.

Owner
Sem
Self learning software and electrical engineering
Sem
A discord bot for tracking Iranian Minecraft servers and showing the statistics of them

A discord bot for tracking Iranian Minecraft servers and showing the statistics of them

MCTracker 20 Dec 30, 2022
This is a small Messnger with the cmd as an interface

Messenger This is a small messenger with the cmd as an interface. It started as a project to learn more about Python 3. If you want to run a version o

1 Feb 24, 2022
Yok bentar lagi update Premium :( DI FOLLOW YA GUYS

SIMBF + PREMIUM PRINTAH PENGINSTALAN ON TERMUX $ pkg update && upgrade $ termux-setup-storage $ pkg install python $ pkg install git $ pip install bs4

Jeeck 21 Jan 14, 2022
StudyLion is a Discord bot that tracks members' study and work time while offering members to view their statistics and use productivity tools such as: To-do lists, Pomodoro timers, reminders, and much more.

StudyLion - Discord Productivity Bot StudyLion is a Discord bot that tracks members' study and work time while offering members the ability to view th

45 Dec 26, 2022
GroupMenter : New Telegram Group Manager Bot🔸Fast 🔸Python🔸Pyrogram 🔸

GroupMenter An PowerFull Group Manager Bot. Written In Pytelethon. Info • A modular Telegram Python bot running on python3. • Can be found on telegram

Group Menter 24 Jun 28, 2022
Modular Python-based Twitch bot optimized for customizability and ease of use.

rasbot Modular Python-based Twitch bot optimized for customizability and ease of use. rasbot is a Python-based Twitch bot that runs on your Twitch acc

raspy 9 Dec 14, 2022
Terraform Cloud CLI for Managing Workspace Terraform Versions

Terraform Cloud Version Manager This tiny script makes it easy to update the Terraform Version on all of the Workspaces inside Terraform Cloud. It wil

Robert Hafner 1 Jan 07, 2022
Automatically pick a winner who Retweeted, Commented, and Followed your Twitter account!

AutomaticTwitterGiveaways automates selecting winners for "Retweet, Comment, Follow" type Twitter giveaways.

1 Jan 13, 2022
a translator bot for discord

TranslatorBOT it is a simple and powerful discord bot, it been used for translating includes more than 100 language, it has a lot of integrated comman

Mear. 2 Feb 03, 2022
NFT which pays royalties to its creator each time it is sold.

Chialisp NFT with Perpetual Creator Royalties This is a chialisp NFT in which the creator/minter defines a puzzle hash which will capture a fixed perc

Geoff Walmsley 20 Jun 28, 2022
Images to PDF Telegram Bot

ilovepdf Convert Images to PDF Bot This bot will helps you to create pdf's from your images [without leaving telegram] 😉 By Default: your pdf fil

✰Naͥbiͣlͫ A Navab✰ 116 Dec 29, 2022
AutomaTik is an automation system for MikroTik devices with simplicity and security in mind.

AutomaTik Installation AutomaTik is an automation system for MikroTik devices with simplicity and security in mind. Winbox is the main tool for MikroT

Osman Kazdal 4 Dec 05, 2022
Mikasa is a 100% Spanish bot, a multifunctional bot, Mikasa is in beta.

Mikasa Miaksa, It is a multi-functional discord bot that is currently in development, this is not complete, there are still many things to fix and imp

Made in 2 Oct 05, 2021
Decryption utility for PGP Whole Disk Encryption

wdepy: Decryption and Inspection for PGP WDE Disks This is a small python tool to inspect and decrypt disk images encrypted with PGP Whole Disk Encryp

Brendan Dolan-Gavitt 17 Oct 07, 2022
Simple Telegram Bot to Download and Upload Files From Mega.nz

Mega.nz-Bot Simple Telegram Bot to Download Files From Mega.nz and Upload It to Telegram Features All Mega.nz File Links supported No login required A

I'm Not A Bot #Left_TG 245 Jan 01, 2023
Acid's Utilities is a bot for my Discord server that alerts when I go live, welcomes new users, has some awesome games and so much more!

Acid's Utilities Acid's Utilities is a bot for my Discord server that alerts when I go live, welcomes new users, has some awesome games and so much mo

AcidFilms (Fin Stuart) 3 Nov 19, 2021
A Discord bot that may save your day by predicting it.

Sage A Discord bot that may save your day by predicting it.

1 Nov 17, 2022
A small discord bot to interface with python-discord's snekbox.

A small discord bot to interface with python-discord's snekbox.

Hassan Abouelela 0 Oct 05, 2021
Dns-Client-Server - Dns Client Server For Python

Dns-client-server DNS Server: supporting all types of queries and replies. Shoul

Nishant Badgujar 1 Feb 15, 2022
The modern Lavalink wrapper designed for discord.py

Pomice The modern Lavalink wrapper designed for discord.py This library is heavily based off of/uses code from the following libraries: Wavelink Slate

Gstone 1 Feb 02, 2022