PyJSONViewer
所属分类:Python编程
开发工具:Python
文件大小:222KB
下载次数:0
上传日期:2021-12-30 06:14:09
上 传 者:
sh-1993
说明: 使用纯python的JSON查看器
(A JSON viewer using pure python)
文件列表:
LICENSE (1070, 2021-12-28)
MANIFEST.in (59, 2021-12-28)
dat (0, 2021-12-28)
dat\dictionary.json (969, 2021-12-28)
dat\list.json (435, 2021-12-28)
dat\nested.json (1446, 2021-12-28)
img (0, 2021-12-28)
img\centos.PNG (32145, 2021-12-28)
img\history.png (55552, 2021-12-28)
img\icon.png (31494, 2021-12-28)
img\mac.png (37376, 2021-12-28)
img\ubuntu.png (19614, 2021-12-28)
img\windows.png (10844, 2021-12-28)
pyjsonviewer (0, 2021-12-28)
pyjsonviewer\CHANGELOG.md (1887, 2021-12-28)
pyjsonviewer\VERSION (6, 2021-12-28)
pyjsonviewer\__init__.py (35, 2021-12-28)
pyjsonviewer\__main__.py (81, 2021-12-28)
pyjsonviewer\bump-version.sh (3396, 2021-12-28)
pyjsonviewer\icon.png (41345, 2021-12-28)
pyjsonviewer\pyjsonviewer.py (11593, 2021-12-28)
sample.json (969, 2021-12-28)
setup.py (1768, 2021-12-28)
tests (0, 2021-12-28)
tests\test_pyjsonviewer.py (1606, 2021-12-28)
# PyJSONViewer
A JSON file data viewer using pure python
[![CI](https://github.com/AtsushiSakai/PyJSONViewer/actions/workflows/CI.yml/badge.svg)](https://github.com/AtsushiSakai/PyJSONViewer/actions/workflows/CI.yml)
[![Downloads](https://pepy.tech/badge/pyjsonviewer)](https://pepy.tech/project/pyjsonviewer)
[![Downloads](https://pepy.tech/badge/pyjsonviewer/month)](https://pepy.tech/project/pyjsonviewer)
[![Downloads](https://pepy.tech/badge/pyjsonviewer/week)](https://pepy.tech/project/pyjsonviewer)
# Gallery
- Mac OS
![img1](https://github.com/AtsushiSakai/PyJSONViewer/raw/master/img/mac.png)
- Windows10
![img1](https://github.com/AtsushiSakai/PyJSONViewer/raw/master/img/windows.png)
- Ubuntu
![img1](https://github.com/AtsushiSakai/PyJSONViewer/raw/master/img/ubuntu.png)
# What is this?
This is a JSON file data viewer based on python.
It only uses built-in libraries of python (tkinter, json).
Features:
1. Minimum dependency.
2. Multi-platform (Mac, Windows, Linux).
3. Easy to use.
# Requirements
- Python 3.7 or higher
# Download
>$ pip install PyJSONViewer
or download as zip.
- [PyJSONViewer · PyPI](https://pypi.org/project/PyJSONViewer/)
# How to use
## Select JSON file with CUI.
1. Run pyjsonviewer with -f option and the path to a JSON file:
> $ pyjsonviewer -f path\_to\_json\_file/sample.json
2. JSON data tree will be shown.
## Select JSON file with GUI.
1. Run pyjsonviewer
> $ pyjsonviewer
2. File-\>Open and then select json file.
3. JSON data tree will be shown.
You can set initial directory:
> $ pyjsonviewer -d path\_to\_json\_file\_dir
## Select JSON file from history.
1. Run pyjsonviewer.py
2. File-\>"Open from history" and then double click a json file path from the list.
![img1](https://github.com/AtsushiSakai/PyJSONViewer/raw/master/img/history.png)
3. JSON data tree will be shown.
## Select JSON file with drag and drop.
1. Run pyjsonviewer.py with the option -o
> $ python pyjsonviewer.py -o path\_to\_json\_file\_dir
2. File browser is shown.
3. You can drag and drop a JSON file to the file browser.
## Menu bar function
- Expand all items: Tools -> Expand all
- Collapse all items: Tools -> Collapse all
- Show version: Help -> About
- Show github page: Help -> GitHub page
- Show release note: Help -> Release note
## Inside python code
### View json file
```
import pyjsonviewer
pyjsonviewer.view_data(json_file="dat/list.json")
```
JSON data tree will be shown.
### View json object
```
import pyjsonviewer
json_object = {"a":[1,2,3], "b":"test"}
pyjsonviewer.view_data(json_data=json_object)
```
JSON data tree will be shown.
## Vimrc setting
If you are a vim user, you can set this command in your vimrc.
"JSON format
function! JsonFormat()
%!python -m json.tool
endfunction
command! JsonFormat :call JsonFormat()
"JSON viewer
function! JsonViewer()
"%!python -m pyjsonviewer -f % > /dev/null
let filename = expand('%')
let s:job = job_start(
\ ["/bin/sh", "-c", "python -m pyjsonviewer -f".filename],{})
endfunction
command! JsonViewer :call JsonViewer()
When you are editing a json file with vim,
you can open it using PyJSONViewer with
>: JSONViewer()
You can also format json file with
>: JSONFormat()
# Open a link with a browser
If a URL is included in a json file,
you can open it with a browser with double click the URL.
# License
MIT
# Author
- [Atsushi Sakai](https://github.com/AtsushiSakai/) ([@Atsushi_twi](https://twitter.com/Atsushi_twi))
近期下载者:
相关文件:
收藏者: