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
Python script to backup/convert your Spotify playlists into the XSPF format.

Python script to backup/convert your Spotify playlists into the XSPF format.

Chris Ovenden 4 Jun 09, 2022
iCloudPy is a simple iCloud webservices wrapper library written in Python

iCloudPy 🤟 Please star this repository if you end up using the library. It will help me continue supporting this product. 🙏 iCloudPy is a simple iCl

Mandar Patil 49 Dec 26, 2022
A simple library for interacting with Amazon SQS.

qoo is a very simple Amazon SQS client, written in Python. It aims to be much more straight-forward to use than boto3, and specializes only in Amazon

Jacobi Petrucciani 2 Oct 30, 2020
Upload on Doodstream by Url, File and also by direct forward post from other channel...

Upload on Doodstream by Url, File and also by direct forward post from other channel...

Pʀᴇᴅᴀᴛᴏʀ 8 Aug 10, 2022
✖️ Unofficial API of 1337x.to

✖️ Unofficial Python API Wrapper of 1337x This is the unofficial API of 1337x. It supports all proxies of 1337x and almost all functions of 1337x. You

Hemanta Pokharel 71 Dec 26, 2022
Download archived malware from ActiveState's source code mirror

malware-archivist (ma) Tool to aid security researchers in dissecting malware. Often, repository maintainers will remove malicious packages entirely f

ActiveState Software 28 Dec 12, 2022
POC de uma AWS lambda que executa a consulta de preços de criptomoedas, e é implantada na AWS usando Github actions.

Cryptocurrency Prices Overview Instalação Repositório Configuração CI/CD Roadmap Testes Overview A ideia deste projeto é aplicar o conteúdo estudado s

Gustavo Santos 3 Aug 31, 2022
This is my Discord-Bot named priamoryki-bot based on python.

This is my Discord-Bot named priamoryki-bot based on python. It's a public repository without private information, so you need to correct some code for everything to be working.

priamoryki 2 Dec 14, 2022
A small and fun Discord Bot that is written in Python and discord-interactions (with discord.py)

Articuno (discord-interactions) A small and fun Discord Bot that is written in Python and discord-interactions (with discord.py) Get started If you wa

Blue 8 Dec 26, 2022
Minecraft checker

This Project checks if a minecraft account is a nfa/sfa account or invalid it also says you if the ip you are using is shadow banned from minecraft (shadow bann is if you send too many login attempts

baum1810 4 Oct 03, 2022
A Telegram Bot for searching any channel messages from Inline by @AbirHasan2005

Message-Search-Bot A Telegram Bot for searching any channel messages from Inline by @AbirHasan2005. I made this for @AHListBot. You can use this for s

Abir Hasan 44 Dec 27, 2022
Crystal Orb is a discord bot made from discord.py and python

Crystal orb Replacing barbot Overview Crystal Orb is a discord bot made from discord.py and python, Crystal Orb is for anti alt detection and other st

AlexyDaCoder 3 Nov 28, 2021
DongTai API SDK For Python

DongTai-SDK-Python Quick start You need a config file config.json { "DongTai":{ "token":"your token", "url":"http://127.0.0.1:90"

huoxian 50 Nov 24, 2022
This library is for simplified work with the sms-man.com API

SMSMAN Public API Python This is a lightweight library that works as a connector to Sms-Man public API Installation pip install smsman Documentation h

13 Nov 19, 2022
Changes your desktop wallpaper based on the weather.

WallPaperChanger 🖼️ Description ⛈️ This Python script changes your desktop wallpaper based on the weather. Cloning 🌀 $ git clone https://github.com/

Clarence Yang 74 Nov 29, 2022
A curated list of awesome Amazon Web Services (AWS) libraries, open source repos, guides, blogs, and other resources.

A curated list of awesome Amazon Web Services (AWS) libraries, open source repos, guides, blogs, and other resources. Featuring the Fiery Meter of AWSome.

Donne Martin 11.1k Jan 04, 2023
Tools to help record data from Qiskit jobs

archiver4qiskit Tools to help record data from Qiskit jobs. Install with pip install git+https://github.com/NCCR-SPIN/archiver4qiskit.git Import the

0 Dec 10, 2021
AI-El-Yazisini-Tanima - Fotoğraflardaki El Yazını Yapay Zeka İle Otomatik Tanıma Yazılımı

AI-El Yazısını Tanıma Fotoğraflardaki El Yazını Yapay Zeka İle Otomatik Tanıma Yazılımı Amaç : Birden fazla makine öğrenmesi modelini bir arada kullan

Özgür Tokay 3 Mar 02, 2022
Simple Telegram webscrap bot

webscrap-bot Simple Telegram webscrap bot Configs TOKEN - Get bot token from @BotFather API_ID - From my.telegram.org API_HASH - From my.telegram.org

lokaman chendekar 10 Oct 21, 2022
GTK3-based panel for sway window manager

nwg-panel I have been using sway since 2019 and find it the most comfortable working environment, but... Have you ever missed all the graphical bells

Piotr Miller 290 Jan 07, 2023