| Server IP : 173.249.148.11 / Your IP : 216.73.216.179 Web Server : Apache/2.4.68 (AlmaLinux) System : Linux developmentwebsite.ca 4.18.0-553.168.1.el8_10.x86_64 #1 SMP Thu Sep 24 18:05:46 UTC 2026 x86_64 User : devinter ( 1006) PHP Version : 8.3.35 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /snap/core/17284/usr/lib/python3.5/json/__pycache__/ |
Upload File : |
i
�hm � @ sY d Z d d l Z d d l Z d d l Z d d l Z d d � Z e d k rU e � 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)
� Nc # C sz d } d } t j d | d | � } | j d d d d t j � d d
�| j d d d d t j d � d d
�| j d d d d d d d �| j � } | j p� t j } | j p� t j } | j
} | �m y4 | r� t j | � } n t j | d t
j �} Wn1 t k
r7} z t | � � WYd d } ~ Xn XWd QRX| �. t j | | d | d d �| j d � Wd QRXd S)Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.�prog�description�infile�nargs�?�type�helpz-a JSON file to be validated or pretty-printed�outfile�wz%write the output of infile to outfilez--sort-keys�action�
store_true�defaultFz5sort the output of dictionaries alphabetically by keyZobject_pairs_hook� sort_keys�indent� �
)�argparse�ArgumentParser�add_argumentZFileType�
parse_argsr �sys�stdinr �stdoutr �json�load�collections�OrderedDict�
ValueError�
SystemExit�dump�write) r r �parserZoptionsr r r �obj�e� r$ �/usr/lib/python3.5/json/tool.py�main s0 ! &r&