
    d                         d Z ddlZddlZddlZddlmZ d Zedk    r5	  e             dS # e$ r Z	 ej
        e	j                   Y dZ	[	dS dZ	[	ww xY wdS )a  Command-line tool to validate and pretty-print JSON

Usage::

    $ echo '{"json":"obj"}' | python -m json.tool
    {
        "json": "obj"
    }
    $ echo '{ 1.2:3.4}' | python -m json.tool
    Expecting property name enclosed in double quotes: line 1 column 3 (char 2)

    N)Pathc                     d} d}t          j        | |          }|                    ddt          j        d          dt          j        	           |                    d
dt          dd 	           |                    dddd           |                    dddd           |                    dddd           |                                }|                    ddt          d           |                    ddddd !           |                    d"ddd d#!           |                    d$dd%&           |	                                }|j
        |j        |j        d'}|j        r
d |d<   d(|d)<   |j        5 }	 |j        rd* |D             }nt!          j        |          f}|j        t          j        }n|j                            d+d          }|5 }	|D ]*}
t!          j        |
|	fi | |	                    d,           +	 d d d            n# 1 swxY w Y   n!# t.          $ r}t1          |          d }~ww xY wd d d            d S # 1 swxY w Y   d S )-Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)progdescriptioninfile?zutf-8)encodingz-a JSON file to be validated or pretty-printed)nargstypehelpdefaultoutfilez%write the output of infile to outfilez--sort-keys
store_trueFz5sort the output of dictionaries alphabetically by key)actionr   r   z--no-ensure-asciiensure_asciistore_falsez(disable escaping of non-ASCII characters)destr   r   z--json-linesznparse input using the JSON Lines format. Use with --no-indent or --compact to produce valid JSON Lines output.z--indent   zJseparate items with newlines and use this number of spaces for indentation)r   r   r   z--tabstore_constindent	z9separate items with newlines and use tabs for indentation)r   r   constr   z--no-indentz/separate items with spaces rather than newlinesz	--compactz1suppress all whitespace separation (most compact))r   r   )	sort_keysr   r   ),:
separatorsc              3   >   K   | ]}t          j        |          V  d S )N)jsonloads).0lines       /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.11/json/tool.py	<genexpr>zmain.<locals>.<genexpr>A   s,      <<T
4((<<<<<<    w
)argparseArgumentParseradd_argumentFileTypesysstdinr   add_mutually_exclusive_groupint
parse_argsr   r   r   compactr   
json_linesr   loadr   stdoutopendumpwrite
ValueError
SystemExit)r   r   parsergroupoptions	dump_argsr   objsoutr   objes               r"   mainrA      s    D@K$$KHHHF
%.@@@L #	  + + + 	!D $  & & & lET  V V V
+.G  I I I
|U`  a a a //11E	z133  4 4 4 
w}8! ).  / / / 
}]!M  O O O 
{<O  Q Q Q!!G &., I
  +"	("*	,	  6	 ! ,<<V<<<	&))+&jo**3*AA ( ( (CIc788i888MM$''''(( ( ( ( ( ( ( ( ( ( ( ( ( ( (  	  	  	 Q--	                                    s[   ;I=AH.HHH	HH	HI
H=)H88H==III__main__)__doc__r'   r   r+   pathlibr   rA   __name__BrokenPipeErrorexcexiterrno r$   r"   <module>rK      s       



      ;  ;  ; | z    s   
+ AAA