Skip to main content

Convert Python Data to JS through JSON

Project description

pconv

Convert Python data to Javascript through JSON. Read, Write, and Update data through JSON files for multi-language compatibility.

Installation and use

Prerequisite:

If you haven't already, install the latest version of pip and Python. The package may only run on Python versions that are 3.7 or higher.

Check Pip Version:

pip --version

Check Python Version:

python --version

Install pconv:

pip install pconv_lib

Install pconv with pip3:

pip3 install pconv_lib

Import Library to File:

from pconv_lib import pconv

Dependencies

pconv depends on the following Python modules for development:

  • sys - utilities for system variables and function.
  • json - Allows Python to interact with JSON files.

Full Python script reference

Initialization

Before interacting with the package, you must set a filepath of the relative json that needs to be worked with.

var pconv_var = pconv.Conv('FILEPATH_OF_JSON')

Adding Data to JSON

pconv will add data in the form of a dictionary to the JSON file.

pconv_var.attach('FILEPATH_OF_JSON', 'KEY_VALUE', 'CORRESPONDING_VALUE')

Note: If there is a key that is being added to the JSON that has already been added before, the function will override past data on the JSON by nature.

A user may also be faced with an error of type NoFilepathFoundError if their filepath is incorrect. View the Errors section of this documentation for more information.

Loading Specific Keys

Loads a value of a desired key in the JSON.

returned_var = pconv_var.load('DESIRED_KEY')

If a key is not found, pconv will return None.

Loading All Data

View all the data in the form of a dictionary.

result_from_json = pconv_var.spill()

Note: If the json is empty, the function will return None.

Errors

A very common error that a user might face is:

NoFilepathFoundError: FILE_PATH not found

In this case, it is essential that the user has typed the correct filepath and has ensured that the json file is actually placed in their desired location. pconv does not take filenames, but paths. A common mistake users have is that they do not place, ./ before the parent directory to indicate that the location is within our present directory location on the Operating System.

Resources (Coming Soon)

Contact Information

Here are some of the ways you can find me:

Made by @Jaival - 2022

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pconv_lib-0.0.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pconv_lib-0.0.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pconv_lib-0.0.3.tar.gz.

File metadata

  • Download URL: pconv_lib-0.0.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for pconv_lib-0.0.3.tar.gz
Algorithm Hash digest
SHA256 86e2c36ea4c4f25a8f6127eacd0216a0c52100fe14b51b3bd50b9ad62f0824e6
MD5 a701474e691779f600c806819d026bf8
BLAKE2b-256 bf384ee303f936e585d47875c56a5ffdcb2d40479b5d0c0952f142d57f83f5ca

See more details on using hashes here.

File details

Details for the file pconv_lib-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pconv_lib-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for pconv_lib-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1899b4889c70c51a97bbd9b89cea7ee15298df02666aca5b32c4bef932c7e278
MD5 8a53ac97b5f878f1776c33eaa191ec28
BLAKE2b-256 7cc5f54413e0d42a5b5738f246517920e59971b60486a6e5b1aad860b4ec038f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page