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
multi-purpose discord bot

virus multi-purpose discord bot ⚠️ WARNING This project is incomplete and may not work as expected. Download & Run Install Python =3.10 Clone the sou

miten 2 Jan 17, 2022
This very basic script can be used to automate COVID-19 vaccination slot booking on India's Co-WIN Platform.

COVID-19 Vaccination Slot Booking Script This very basic CLI based script can be used to automate covid vaccination slot booking on Co-WIN Platform. I

605 Dec 14, 2022
A heraldry-related bot, designed for the Heraldry Community.

Heraldtron A heraldry-related bot, designed for the Heraldry Community. Requirements Python 3.9+ discord.py aiohttp (comes installed with discord.py)

1 Mar 31, 2022
A Simple Telegram Bot that can Download Files From Mega.nz and Upload It to Telegram

MegaDL-Bot A Simple Telegram Bot By @mrkpbots to Download Files From Mega.nz and Upload It to Telegram Features No Login Required All Mega.nz File Lin

MRKP BOTS 5 Feb 20, 2022
A python to scratch API connector. Can fetch data from the API and send it back in cloud variables.

Scratch2py Scratch2py or S2py is a easy to use, versatile tool to communicate with the Scratch API Based of scratchclient by Raihan142857 Installation

20 Jun 18, 2022
Roblox-Account-Gen - A simple account generator not using paid solving services

Roblox Account Generator Star this if it helped to spread awareness! No 2captcha

x 1 Feb 17, 2022
An EmbedBuilder for Discord bots in Python.

An EmbedBuilder for Discord bots in Python. You need discord.py to use this module.

6 Jan 13, 2022
Docker image for epicseven gvg qq chatbot based on Xunbot

XUN_Langskip XUN 是一个基于 NoneBot 和 酷Q 的功能型QQ机器人,目前提供了音乐点播、音乐推荐、天气查询、RSSHub订阅、使用帮助、识图、识番、搜番、上车、磁力搜索、地震速报、计算、日语词典、翻译、自我检查,权限等级功能,由于是为了完成自己在群里的承诺,一时兴起才做的,所

Xavier Xiong 2 Jun 08, 2022
This is a simple grabber written in Python which helps you to grab products from Willhaben.at

Willhaben Grabber This is a simple grabber written in Python which helps you to grab products from Willhaben.at General info The tool generates a sear

Ramo 0 Feb 16, 2022
This is a tutorial on how to make a Discord Bot using the discord.py library

HowToMakeADiscordBot This Github repository is here to help you code a Discord Bot using the discord.py library! 1 - Setup: Download the code inside t

Baz 1 Oct 31, 2021
Ciclo 1 - MisiónTIC - UIS (Retos)

misiontic_uis Ciclo 1 - MisiónTIC - UIS Reto 1: Fundamentos del Lenguaje Python Reto 2: Estructuras de Control Condicional Reto 3: Estructuras de Cont

9 May 24, 2022
Slack bot to automatically delete yubisneeze / accidental yubikey presses

YubiSnooze Slack bot to automatically delete yubisneeze / accidental yubikey presses. It will search using the regex "[cbdefghijklnrtuv]{44}" and if t

Andrew MacPherson 3 Feb 09, 2022
Real-time cryptocurrencies prices.

New update added more cryptocurrencies and GBP If you like it give it a star Crypto-watcher is simple program showing price of cryptocurrency in USD a

Adrijan 25 Dec 13, 2022
Bot inspirado no Baidu Antivírus

Baidu Bot Bot inspirado no lendário Baidu Antivírus Informações O programa foi inteiramente feito em Python, sinta-se livre para fazer qualquer altera

Caio Eduardo de Albuquerque Magalhães 1 Dec 18, 2021
A file-based quote bot written in Python

Let's Write a Python Quote Bot! This repository will get you started with building a quote bot in Python. It's meant to be used along with the Learnin

1 Feb 23, 2022
Terraform wrapper to manage state across multiple cloud providers(AWS, GCP, and Azure)

Terraform Remote State Manager(tfremote) tf is a python package for managing terraform remote state for: Google(Gcloud), AWS, and Azure. It sets a def

tomarv2 1 Dec 08, 2021
A light wrapper around FedEx's SOAP API.

Python FedEx SOAP API Module Author: Greg Taylor, Radek Wojcik Maintainer: Python FedEx Developers License: BSD Status: Stable What is it? A light wra

155 Dec 16, 2022
Semplice pagina di informazione per sapere se e quando è uscito Joypad, il podcast a tema videoludico di Matteo Bordone (Corri!), Francesco Fossetti (Salta!) e Alessandro Zampini (Spara! per finta).

È uscito Joypad? Semplice pagina di informazione per sapere se e quando è uscito Joypad, il podcast a tema videoludico di Matteo Bordone (Corri!), Fra

Paolo Donadeo 32 Jan 02, 2023
A really easy way to display your spotify listening status on spotify.

Spotify playing README A really easy way to display your spotify listening status on READMEs and Websites too! Demo Here's the embed from the site. Cu

Sunrit Jana 21 Nov 06, 2022
Asynchronous Python Wrapper for the Ufile API

Ufile.io Asynchronous Python Wrapper for the Ufile API (Unofficial).

Gautam Kumar 16 Aug 31, 2022