jsonwhatever


Namejsonwhatever JSON
Version 1.1.1 PyPI version JSON
download
home_page
SummaryA simple JSON string creator that takes whatever you have and transform it into a String
upload_time2022-12-24 09:14:20
maintainer
docs_urlNone
authordazjuancarlos
requires_python
licenseMIT
keywords python json simple
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # jsonwhatever

jsonwhatever is a library that creates a string, just putting a name and the object as arguments.

## Installation

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install jsonwhatever.

```bash
pip install jsonwhatever
```

## Usage

```python
from jsonwhatever import JsonWhatEver

thisdict = {
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964
}

class Dog:
  def __init__(self) -> None:
    self.id = 0
    self.name = 'fido'
    self.size = 5.3

class Person:
  def __init__(self, id, name, dog) -> None:
    self.id = id
    self.name = name
    self.dog = dog

dog_a = Dog()

complex_number = 5+9j
list_b = [4,5,6,8]
list_a = [2,3,'hello',7,list_b]
list_c = [4,5,thisdict,8,complex_number]
empty_list = []
none_var = None
bool_var = True
set_example_empty = set()
set_example = {1,2,3,4}
class_example = Person(9,'john',dog_a)
bytes_example = bytes(4)
bytearray_example = bytearray(4)

#########################
jsonwe = JsonWhatEver()
#########################

#prints {"list_example":[4,5,6,8]}
print(jsonwe.jsonwhatever('list_example',list_b))

#prints {"name":"john"}
print(jsonwe.jsonwhatever('name','john'))

#prints {"size":1.7}
print(jsonwe.jsonwhatever('size',1.7))

#prints {"empty_list":[]}
print(jsonwe.jsonwhatever('empty_list',empty_list))

#prints {"none_example":null}
print(jsonwe.jsonwhatever('none_example',none_var))

#prints {"boolean":True}
print(jsonwe.jsonwhatever('boolean',bool_var))

#prints {"empty_set":[]}
print(jsonwe.jsonwhatever('empty_set',set_example_empty))

#prints {"set_example":[1,2,3,4]}
print(jsonwe.jsonwhatever('set_example',set_example))

#prints {"brand":"Ford","model":"Mustang","year":1964}
print(jsonwe.jsonwhatever('thisdict',thisdict))

#prints {"id":9,"name":"juan",{"id":0,"name":"perro","size":5.3}}
print(jsonwe.jsonwhatever('person_class',class_example))

#prints {"bytes_example":"b'\x00\x00\x00\x00'"}
print(jsonwe.jsonwhatever('bytes_example',bytes_example))

#prints {"bytearray_example":"b'\x00\x00\x00\x00'"}
print(jsonwe.jsonwhatever('bytearray_example',bytearray_example))

#prints {"crazy_list":[4,5,{"brand":"Ford","model":"Mustang","year":1964},8,"(5+9j)"]}
print(jsonwe.jsonwhatever('crazy_list',list_c))


```


## Contributing

Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.

Please make sure to update tests as appropriate.

## Things to know about
1) You always have to put some name on the first argument of the jsonwhatever function, otherwise the function will return a string that does not match the json standard.
2) The jsonwhatever function can allow recursivity on a list until the level 800, after that, it will rise the RecursionError exception.

3) The jsonwhatever function allows you to recieve a json without the curly braces at the beginning and in the end of the phrase. By default it will be in True.

```python

#prints "name":"john"
print(jsonwe.jsonwhatever('name','john',False))

#prints {"name":"john"}
print(jsonwe.jsonwhatever('name','john',True))
print(jsonwe.jsonwhatever('name','john'))
```

## Release Notes
1) The main structure in the library is an object class.
2) Now a few attributes are private, like the datatypes.
3) The class can detect the ammount of levels of recursions.
4) The maximum level of recursions are 800, after that it will raise a RecursionError exception.
5) We fixed a bug in the recursion counter, that stops the recursion after the number 800.
6) The Big O notation is O(n), but after 2 million items the behavior stops being linear.


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "jsonwhatever",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,json,simple",
    "author": "dazjuancarlos",
    "author_email": "dazjuancarlos@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/88/36/f206f7292cb70356ced3d5b84b68688ef77a31bf73b1a9b234852ac4a937/jsonwhatever-1.1.1.tar.gz",
    "platform": null,
    "description": "# jsonwhatever\r\n\r\njsonwhatever is a library that creates a string, just putting a name and the object as arguments.\r\n\r\n## Installation\r\n\r\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install jsonwhatever.\r\n\r\n```bash\r\npip install jsonwhatever\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom jsonwhatever import JsonWhatEver\r\n\r\nthisdict = {\r\n  \"brand\": \"Ford\",\r\n  \"model\": \"Mustang\",\r\n  \"year\": 1964\r\n}\r\n\r\nclass Dog:\r\n  def __init__(self) -> None:\r\n    self.id = 0\r\n    self.name = 'fido'\r\n    self.size = 5.3\r\n\r\nclass Person:\r\n  def __init__(self, id, name, dog) -> None:\r\n    self.id = id\r\n    self.name = name\r\n    self.dog = dog\r\n\r\ndog_a = Dog()\r\n\r\ncomplex_number = 5+9j\r\nlist_b = [4,5,6,8]\r\nlist_a = [2,3,'hello',7,list_b]\r\nlist_c = [4,5,thisdict,8,complex_number]\r\nempty_list = []\r\nnone_var = None\r\nbool_var = True\r\nset_example_empty = set()\r\nset_example = {1,2,3,4}\r\nclass_example = Person(9,'john',dog_a)\r\nbytes_example = bytes(4)\r\nbytearray_example = bytearray(4)\r\n\r\n#########################\r\njsonwe = JsonWhatEver()\r\n#########################\r\n\r\n#prints {\"list_example\":[4,5,6,8]}\r\nprint(jsonwe.jsonwhatever('list_example',list_b))\r\n\r\n#prints {\"name\":\"john\"}\r\nprint(jsonwe.jsonwhatever('name','john'))\r\n\r\n#prints {\"size\":1.7}\r\nprint(jsonwe.jsonwhatever('size',1.7))\r\n\r\n#prints {\"empty_list\":[]}\r\nprint(jsonwe.jsonwhatever('empty_list',empty_list))\r\n\r\n#prints {\"none_example\":null}\r\nprint(jsonwe.jsonwhatever('none_example',none_var))\r\n\r\n#prints {\"boolean\":True}\r\nprint(jsonwe.jsonwhatever('boolean',bool_var))\r\n\r\n#prints {\"empty_set\":[]}\r\nprint(jsonwe.jsonwhatever('empty_set',set_example_empty))\r\n\r\n#prints {\"set_example\":[1,2,3,4]}\r\nprint(jsonwe.jsonwhatever('set_example',set_example))\r\n\r\n#prints {\"brand\":\"Ford\",\"model\":\"Mustang\",\"year\":1964}\r\nprint(jsonwe.jsonwhatever('thisdict',thisdict))\r\n\r\n#prints {\"id\":9,\"name\":\"juan\",{\"id\":0,\"name\":\"perro\",\"size\":5.3}}\r\nprint(jsonwe.jsonwhatever('person_class',class_example))\r\n\r\n#prints {\"bytes_example\":\"b'\\x00\\x00\\x00\\x00'\"}\r\nprint(jsonwe.jsonwhatever('bytes_example',bytes_example))\r\n\r\n#prints {\"bytearray_example\":\"b'\\x00\\x00\\x00\\x00'\"}\r\nprint(jsonwe.jsonwhatever('bytearray_example',bytearray_example))\r\n\r\n#prints {\"crazy_list\":[4,5,{\"brand\":\"Ford\",\"model\":\"Mustang\",\"year\":1964},8,\"(5+9j)\"]}\r\nprint(jsonwe.jsonwhatever('crazy_list',list_c))\r\n\r\n\r\n```\r\n\r\n\r\n## Contributing\r\n\r\nPull requests are welcome. For major changes, please open an issue first\r\nto discuss what you would like to change.\r\n\r\nPlease make sure to update tests as appropriate.\r\n\r\n## Things to know about\r\n1) You always have to put some name on the first argument of the jsonwhatever function, otherwise the function will return a string that does not match the json standard.\r\n2) The jsonwhatever function can allow recursivity on a list until the level 800, after that, it will rise the RecursionError exception.\r\n\r\n3) The jsonwhatever function allows you to recieve a json without the curly braces at the beginning and in the end of the phrase. By default it will be in True.\r\n\r\n```python\r\n\r\n#prints \"name\":\"john\"\r\nprint(jsonwe.jsonwhatever('name','john',False))\r\n\r\n#prints {\"name\":\"john\"}\r\nprint(jsonwe.jsonwhatever('name','john',True))\r\nprint(jsonwe.jsonwhatever('name','john'))\r\n```\r\n\r\n## Release Notes\r\n1) The main structure in the library is an object class.\r\n2) Now a few attributes are private, like the datatypes.\r\n3) The class can detect the ammount of levels of recursions.\r\n4) The maximum level of recursions are 800, after that it will raise a RecursionError exception.\r\n5) We fixed a bug in the recursion counter, that stops the recursion after the number 800.\r\n6) The Big O notation is O(n), but after 2 million items the behavior stops being linear.\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple JSON string creator that takes whatever you have and transform it into a String",
    "version": "1.1.1",
    "split_keywords": [
        "python",
        "json",
        "simple"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "6aca82c1479ef5cee3bb457f64741df3",
                "sha256": "b30e85214f4df22a19e56f1d0730b415623daf44c28a6265781c7b8eec5bceb3"
            },
            "downloads": -1,
            "filename": "jsonwhatever-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6aca82c1479ef5cee3bb457f64741df3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5139,
            "upload_time": "2022-12-24T09:14:19",
            "upload_time_iso_8601": "2022-12-24T09:14:19.087906Z",
            "url": "https://files.pythonhosted.org/packages/43/be/c35cf7f8458f61b04f87233745554cb22110c72ae63d59b00bf0ab867acb/jsonwhatever-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "c7107d31c49f7dc4424c5bf49553fe10",
                "sha256": "c2f76b070e1c302300cf3f9901eb29d4c6da404c4d6b0a63ac9e83f140d432b3"
            },
            "downloads": -1,
            "filename": "jsonwhatever-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c7107d31c49f7dc4424c5bf49553fe10",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4356,
            "upload_time": "2022-12-24T09:14:20",
            "upload_time_iso_8601": "2022-12-24T09:14:20.813986Z",
            "url": "https://files.pythonhosted.org/packages/88/36/f206f7292cb70356ced3d5b84b68688ef77a31bf73b1a9b234852ac4a937/jsonwhatever-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-24 09:14:20",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "jsonwhatever"
}
        
Elapsed time: 0.02099s