sqlalchemyseed.json
#
Module Contents#
- class sqlalchemyseed.json.JsonWalker(json: Union[list, dict] = None)#
JsonWalker class
- backward(self)#
Revert current json to its parent. Returns reverted current json
- property current_key(self) Union[int, str] #
Returns the key of the current json
- exec_func_iter(self, func: Callable)#
Executes function when iterating
- find_from_current(self, keys: List[Union[int, str]])#
Find item from current json that correlates list of keys
- find_from_root(self, keys: List[Union[int, str]])#
Find item from the root json that correlates list of keys
- forward(self, keys: List[Union[int, str]])#
Move and replace current json forward. Returns current json.
- iter_as_dict_items(self)#
Iterates current as dict. Yields key and value.
Raises TypeError if current json is not dict
- iter_as_list(self)#
Iterates current as list. Yields index and value.
Raises TypeError if current json is not list
- property json(self)#
Returns current json
- property json_is_dict(self)#
Returns true if current json is dict
- property json_is_list(self)#
Returns true if current json is list
- keys(self)#
Returns list of keys either str or int
- reset(self, root=None)#
Resets to initial state. If root argument is supplied, self.root will be replaced.
- sqlalchemyseed.json.sort_json(json: Union[list, dict], reverse=False)#
Sort json function