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
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
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
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
Fileson - JSON File database tools

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

Joonas Pihlajamaa 2 Feb 02, 2022
JSON Interoperability Vulnerability Labs

JSON Interoperability Vulnerability Labs Description These are the companion labs to my research article "An Exploration of JSON Interoperability Vuln

Bishop Fox 168 Dec 25, 2022
With the help of json txt you can use your txt file as a json file in a very simple way

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 Installat

Kshitij 1 Dec 14, 2022
cysimdjson - Very fast Python JSON parsing library

Fast JSON parsing library for Python, 7-12 times faster than standard Python JSON parser.

TeskaLabs 235 Dec 29, 2022
Convert your subscriptions csv file into a valid json for Newpipe!

Newpipe-CSV-Fixer Convert your Google subscriptions CSV file into a valid JSON for Newpipe! Thanks to nikcorg for sharing how to convert the CSV into

Juanjo 44 Dec 29, 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
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
A Cobalt Strike Scanner that retrieves detected Team Server beacons into a JSON object

melting-cobalt 👀 A tool to hunt/mine for Cobalt Strike beacons and "reduce" their beacon configuration for later indexing. Hunts can either be expans

Splunk GitHub 150 Nov 23, 2022
JSON Schema validation library

jsonschema A JSON Schema validator implementation. It compiles schema into a validation tree to have validation as fast as possible. Supported drafts:

Dmitry Dygalo 309 Jan 01, 2023
A JSON utility library for Python featuring Django-style queries and mutations.

JSON Enhanced JSON Enhanced implements fast and pythonic queries and mutations for JSON objects. Installation You can install json-enhanced with pip:

Collisio Technologies 4 Aug 22, 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
Ibmi-json-beautify - Beautify json string with python

Ibmi-json-beautify - Beautify json string with python

Jefferson Vaughn 3 Feb 02, 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
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
Simple, minimal conversion of Bus Open Data Service SIRI-VM data to JSON

Simple, minimal conversion of Bus Open Data Service SIRI-VM data to JSON

Andy Middleton 0 Jan 22, 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
A fast streaming JSON parser for Python that generates SAX-like events using yajl

json-streamer jsonstreamer provides a SAX-like push parser via the JSONStreamer class and a 'object' parser via the ObjectStreamer class which emits t

Kashif Razzaqui 196 Dec 15, 2022