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
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
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
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
simdjson : Parsing gigabytes of JSON per second

JSON is everywhere on the Internet. Servers spend a *lot* of time parsing it. We need a fresh approach. The simdjson library uses commonly available SIMD instructions and microparallel algorithms to

16.3k Dec 29, 2022
A daily updated JSON dataset of all the Open House London venues, events, and metadata

Open House London listings data All of it. Automatically scraped hourly with updates committed to git, autogenerated per-day CSV's, and autogenerated

Jonty Wareing 4 Jan 01, 2022
An tiny CLI to load data from a JSON File during development.

JSON Server - An tiny CLI to load data from a JSON File during development.

Yuvraj.M 4 Mar 22, 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
A Python application to transfer Zeek ASCII (not JSON) logs to Elastic/OpenSearch.

zeek2es.py This Python application translates Zeek's ASCII TSV logs into ElasticSearch's bulk load JSON format. For JSON logs, see Elastic's File Beat

Corelight, Inc. 28 Dec 22, 2022
This open source Python project allow you to create JSON data trees using Minmup.com

This open source Python project allow you to create JSON data trees using Minmup.com. I try to develop this project all the time. But feel free to use :).

Arttu Väisänen 1 Jan 30, 2022
Python script to extract news from RSS feeds and save it as json.

Python script to extract news from RSS feeds and save it as json.

Alex Trbznk 14 Dec 22, 2022
Low code JSON to extract data in one line

JSON Inline Low code JSON to extract data in one line ENG RU Installation pip install json-inline Usage Rules Modificator Description ?key:value Searc

Aleksandr Sokolov 12 Mar 09, 2022
Python script for converting .json to .md files using Mako templates.

Install Just install poetry and update script dependencies Usage Put your settings in settings.py and .json data (optionally, with attachments) in dat

Alexey Borontov 6 Dec 07, 2021
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
json|dict to python object

Pyonize convert json|dict to python object Setup pip install pyonize Examples from pyonize import pyonize

bilal alpaslan 45 Nov 25, 2022
JSON for Modern C++ Release Scripts

JSON for Modern C++ Release Scripts Preparations Install required tools: make install_requirements. Add required keys to config.json (apparently not c

Niels Lohmann 4 Sep 19, 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
Package to Encode/Decode some common file formats to json

ZnJSON Package to Encode/Decode some common file formats to json Available via pip install znjson In comparison to pickle this allows having readable

ZINC 2 Feb 02, 2022
Small python wrapper around the valico rust library to provide fast JSON schema validation.

Small python wrapper around the valico rust library to provide fast JSON schema validation.

Simon J Knibbs 5 Jul 12, 2019
Creates fake JSON files from a JSON schema

Use jsf along with fake data generators to provide consistent and meaningful fake data for your system.

Andy Challis 86 Jan 03, 2023
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