diff --git a/docs/lib.md b/docs/lib.md
index 5b9bb443..d6c89f7b 100644
--- a/docs/lib.md
+++ b/docs/lib.md
@@ -1,6 +1,7 @@
# Table of Contents
* [jc.lib](#jc.lib)
+ * [get\_parser](#jc.lib.get_parser)
* [parse](#jc.lib.parse)
* [parser\_mod\_list](#jc.lib.parser_mod_list)
* [plugin\_parser\_mod\_list](#jc.lib.plugin_parser_mod_list)
@@ -17,6 +18,26 @@
jc - JSON Convert lib module
+
+
+### get\_parser
+
+```python
+def get_parser(parser_mod_name) -> ModuleType
+```
+
+Return the parser module object
+
+Parameters:
+
+ parser_mod_name: (string or name of the parser module. This
+ Module) function will accept module_name,
+ cli-name, and --argument-name
+ variants of the module name.
+Returns:
+
+ Parser: the parser module object
+
### parse
diff --git a/jc/__init__.py b/jc/__init__.py
index 4a093165..e59824cb 100644
--- a/jc/__init__.py
+++ b/jc/__init__.py
@@ -127,6 +127,7 @@ Get a list of streaming parser module names to be used in
from .lib import (
__version__ as __version__,
parse as parse,
+ get_parser as get_parser,
parser_mod_list as parser_mod_list,
plugin_parser_mod_list as plugin_parser_mod_list,
standard_parser_mod_list as standard_parser_mod_list,
diff --git a/jc/lib.py b/jc/lib.py
index b4480780..ff7c1b29 100644
--- a/jc/lib.py
+++ b/jc/lib.py
@@ -270,6 +270,28 @@ def _parser_argument(parser_mod_name: str) -> str:
parser = _modname_to_cliname(parser_mod_name)
return f'--{parser}'
+def get_parser(parser_mod_name) -> ModuleType:
+ """
+ Return the parser module object
+
+ Parameters:
+
+ parser_mod_name: (string or name of the parser module. This
+ Module) function will accept module_name,
+ cli-name, and --argument-name
+ variants of the module name.
+ Returns:
+
+ Parser: the parser module object
+
+
+ """
+ if isinstance(parser_mod_name, ModuleType):
+ jc_parser = parser_mod_name
+ else:
+ jc_parser = _get_parser(parser_mod_name)
+ return jc_parser
+
def _get_parser(parser_mod_name: str) -> ModuleType:
"""Return the parser module object"""
# ensure parser_mod_name is a true module name and not a cli name
@@ -409,10 +431,7 @@ def parse(
Standard Parsers: Dictionary or List of Dictionaries
Streaming Parsers: Generator Object containing Dictionaries
"""
- if isinstance(parser_mod_name, ModuleType):
- jc_parser = parser_mod_name
- else:
- jc_parser = _get_parser(parser_mod_name)
+ jc_parser = get_parser(parser_mod_name)
if ignore_exceptions is not None:
return jc_parser.parse(