
    i                     ,    S SK r SSKJr   " S S5      rg)    N   )DictImporterc                   4    \ rS rSrSrS	S jrS rS rS rSr	g)
JsonImporter   u  
Import Tree from JSON.

The JSON is read and converted to a dictionary via `dictimporter`.

Keyword Arguments:
    dictimporter: Dictionary Importer used (see :any:`DictImporter`).
    kwargs: All other arguments are passed to
            :any:`json.load`/:any:`json.loads`.
            See documentation for reference.

>>> from anytree.importer import JsonImporter
>>> from anytree import RenderTree
>>> importer = JsonImporter()
>>> data = '''
... {
...   "a": "root",
...   "children": [
...     {
...       "a": "sub0",
...       "children": [
...         {
...           "a": "sub0A",
...           "b": "foo"
...         },
...         {
...           "a": "sub0B"
...         }
...       ]
...     },
...     {
...       "a": "sub1"
...     }
...   ]
... }'''
>>> root = importer.import_(data)
>>> print(RenderTree(root))
AnyNode(a='root')
├── AnyNode(a='sub0')
│   ├── AnyNode(a='sub0A', b='foo')
│   └── AnyNode(a='sub0B')
└── AnyNode(a='sub1')
Nc                     Xl         X l        g Ndictimporterkwargs)selfr   r   s      J/app/mltbenv/lib/python3.13/site-packages/anytree/importer/jsonimporter.py__init__JsonImporter.__init__3   s    (    c                 ^    U R                   =(       d
    [        5       nUR                  U5      $ r	   )r   r   import_)r   datar   s      r   __importJsonImporter.__import7   s%    ((:LN##D))r   c                 b    U R                  [        R                  " U40 U R                  D65      $ )zRead JSON from `data`.)_JsonImporter__importjsonloadsr   )r   r   s     r   r   JsonImporter.import_;   s#    }}TZZ<<==r   c                 b    U R                  [        R                  " U40 U R                  D65      $ )zRead JSON from `filehandle`.)r   r   loadr   )r   
filehandles     r   readJsonImporter.read?   s#    }}TYYzAT[[ABBr   r
   r	   )
__name__
__module____qualname____firstlineno____doc__r   r   r   r   __static_attributes__ r   r   r   r      s    *X*>Cr   r   )r   r   r   r   r'   r   r   <module>r(      s     &;C ;Cr   