| Server IP : 85.214.239.14 / Your IP : 216.73.216.27 Web Server : Apache/2.4.65 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/self/root/usr/lib/python3.5/json/__pycache__/ |
Upload File : |
F��am � @ 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&