With the help of json txt you can use your txt file as a json file in a very simple way

Related tags

JSONpythonjson
Overview

json txt

With the help of json txt you can use your txt file as a json file in a very simple way

Dependencies

  • re
  • filemod pip install filemod

Installation and Usage

  1. use pip install json_txt
  2. Make sure that your pip version is updated pip install --upgrade pip.
  3. Select the correct package for your environment:
  4. Import the package: import json_txt

Functions in the module

1)First load the data of the file using load_txt method you need to load data every time you make changes to it as it is using txt as its main source json_txt.load_txt(filename)

2)extract_keys method helps you extract all the keys from the txt file , and returns them all in the list json_txt.extract_keys(data).

3)extract_values method helps you extract all the values from the specific keys in sequence from the txt file , and returns them in the list. json_txt.extract_keys(data).

4)extract_data method helps you extract all the key value pairs from the txt file to dict json_txt.extract_data(filename)

5)edit_data method helps you edit key's value pair , it takes filename ,key, and a value to change. jason_txt.edit_data(filename,key,value_to_change)

6)Helps you detect weather the var is int or not returs bool json_txt.number_detect(letter)

Run Locally

Clone the project

  git clone https://github.com/kshitij1235/Json_txt/tree/main/dist

Install

  pip install json_txt

List of Functions

functions processs args
load_txt loads the txt data filename
extract_keys extract key from data data
extract_values extract values from data data
extract_data Extracts key value pair filename
edit_data Edit certain key values filename,key,value_to_change

Usage/Examples

way to write your txt

{ 
settings:3
x:4
truck:32
}

Rules : 
1) Dont make any sub tree to write your data do it under one tree/{}
2) Dont put dummy values as it wont consider
3) Dont use any numericals in variable name
4)strictly use : when assigning values

code

import json_txt

###printing basic dictornary 
file=json_txt.load_txt("main.txt") #load the txt file
print(json_txt.extract_data(file)) #printing key value pairs

#####editing data 
json_txt.edit_data("main.txt","settings",33) #changing value of settings
file=json_txt.load_txt("main.txt")   #again laoding the updated copy
print(json_txt.extract_data(file)) #printing the updated key values

####extracting keys and values separately
print(json_txt.extract_keys(file)) #printing the updated key values
print(json_txt.extract_values(file)) #printing the updated values values

Output

{'settings': 3, 'x': 4, 'truck': 32}
{'settings': 33, 'x': 4, 'truck': 32}
['settings', 'x', 'truck']
[33, 4, 32]

Badges

MIT License

Authors

Owner
Kshitij
Languages known - python , c , cpp, html,css, js
Kshitij
Marshall python objects to and from JSON

Pymarshaler - Marshal and Unmarshal Python Objects Disclaimer This tool is in no way production ready About Pymarshaler allows you to marshal and unma

Hernan Romer 9 Dec 20, 2022
The ldap2json script allows you to extract the whole LDAP content of a Windows domain into a JSON file.

ldap2json The ldap2json script allows you to extract the whole LDAP content of a Windows domain into a JSON file. Features Authenticate with password

Podalirius 68 Dec 07, 2022
A JSON API for returning Godspeak sentences. Based on the works of Terry A Davis (Rest in Peace, King)

GodspeakAPI A simple API for generating random words ("godspeaks"), inspired by the works of Terrence Andrew Davis (Rest In Peace, King). Installation

Eccentrici 3 Jan 24, 2022
Fileson - JSON File database tools

Fileson is a set of Python scripts to create JSON file databases

Joonas Pihlajamaa 2 Feb 02, 2022
JsonParser - Parsing the Json file by provide the node name

Json Parser This project is based on Parsing the json and dumping it to CSV via

Ananta R. Pant 3 Aug 08, 2022
Convert your JSON data to a valid Python object to allow accessing keys with the member access operator(.)

JSONObjectMapper Allows you to transform JSON data into an object whose members can be queried using the member access operator. Unlike json.dumps in

Owen Trump 4 Jul 20, 2022
Generate code from JSON schema files

json-schema-codegen Generate code from JSON schema files. Table of contents Introduction Currently supported languages Requirements Installation Usage

Daniele Esposti 30 Dec 23, 2022
Convert Wii UI formats to JSON5 and vice versa

Convert Wii UI formats to JSON5 and vice versa

Pablo Stebler 11 Aug 28, 2022
Random JSON Key:Pair Json Generator

Random JSON Key:Value Pair Generator This simple script take an engish dictionary of words and and makes random key value pairs. The dictionary has ap

Chris Edwards 1 Oct 14, 2021
Atom, RSS and JSON feed parser for Python 3

Atoma Atom, RSS and JSON feed parser for Python 3. Quickstart Install Atoma with pip: pip install atoma

Nicolas Le Manchet 95 Nov 28, 2022
import json files directly in your python scripts

Install Install from git repository pip install git+https://github.com/zaghaghi/direct-json-import.git Use With the following json in a file named inf

Hamed Zaghaghi 51 Dec 01, 2021
Easy JSON wrapper modfied to wrok with suggestions

🈷️ Suggester Easy JSON wrapper modfied to wrok with suggestions. This was made for small discord bots, for big bots you should not use this. 📥 Usage

RGBCube 1 Jan 22, 2022
Console to handle object storage using JSON serialization and deserealization.

Console to handle object storage using JSON serialization and deserealization. This is a team project to develop a Python3 console that emulates the AirBnb object management.

Ronald Alexander 3 Dec 03, 2022
Same as json.dumps or json.loads, feapson support feapson.dumps and feapson.loads

Same as json.dumps or json.loads, feapson support feapson.dumps and feapson.loads

boris 5 Dec 01, 2021
A fast JSON parser/generator for C++ with both SAX/DOM style API

A fast JSON parser/generator for C++ with both SAX/DOM style API Tencent is pleased to support the open source community by making RapidJSON available

Tencent 12.6k Dec 30, 2022
RedisJSON - a JSON data type for Redis

RedisJSON is a Redis module that implements ECMA-404 The JSON Data Interchange Standard as a native data type. It allows storing, updating and fetching JSON values from Redis keys (documents).

3.4k Dec 29, 2022
JSONx - Easy JSON wrapper packed with features.

🈷️ JSONx Easy JSON wrapper packed with features. This was made for small discord bots, for big bots you should not use this JSON wrapper. 📥 Usage Cl

2 Dec 25, 2022
jq for Python programmers Process JSON and HTML on the command-line with familiar syntax.

jq for Python programmers Process JSON and HTML on the command-line with familiar syntax.

Denis Volk 3 Jan 09, 2022
API that provides Wordle (ES) solutions in JSON format

Wordle (ES) solutions API that provides Wordle (ES) solutions in JSON format.

Álvaro García Jaén 2 Feb 10, 2022
simplejson is a simple, fast, extensible JSON encoder/decoder for Python

simplejson simplejson is a simple, fast, complete, correct and extensible JSON http://json.org encoder and decoder for Python 3.3+ with legacy suppo

1.5k Jan 05, 2023