Exemplo n.º 1
0
 def dumps(
     data: Any,
     pretty: bool = False,
     sort_keys: bool = False,
     default: Optional[Callable[[Any], Any]] = None,
     **kwargs: Any,
 ) -> str:
     """Return JSON stringified/dumps-ed data"""
     return str(
         json.dumps(
             data, pretty=pretty, sort_keys=sort_keys, default=default, **kwargs
         )
     )
Exemplo n.º 2
0
    def _to_json(
        self, pretty: bool = False, sort_keys: bool = False, **kwargs: Any
    ) -> str:
        """Return a JSON string of the JsonObj object

        Args:
            minify (bool): Return a 'minified' version of the JSON string
            sort_keys (bool): Sort the keys when converting to JSON
            indent (int): Indent level of the json string
            **kwargs: Keyword args to be passed on to the JSON dumps method

        Returns:
            str: JSON string of the JsonObj object

        """
        return json.dumps(self.to_dict(), pretty=pretty, sort_keys=sort_keys, **kwargs)
Exemplo n.º 3
0
def test_uno():
    from jsonbourne import json

    dictionary = {"a": 1, "b": 2, "c": 3}
    string = json.dumps(dictionary)
    assert dictionary == json.loads(string)