English 中文(简体)
如何在Ubuntu上看到一个大JSON文件?
原标题:How to see a large JSON file pretty printed on Ubuntu? [closed]

我们不允许为软件库、辅导、工具、书籍或其他场外资源寻求建议的问题。 您可以编辑问题, 以便用事实和引用来解答问题。

Closed 4 years ago.

我想听听你关于如何处理Ubuntu 上的大型(40MB) JSON文件的建议。 但是,我希望看到它在 vim gedit 或任何其他编辑中被印得漂亮。 人们可以找到关于如何 < a href=> 的众多教程。 http:// discriminationwhere.wordpress.com/2011/06/23/json- pretacter-for- foldit/" rel=" noreferr" > > > prefricify JSons 。 但是,它们不必处理大量输入。 我还可以想象我可以通过 < a href=" http://pygments.org/" rel=" noreferr> pygments 或任何其他语法突出人物。我很想知道您的想法。

示例下载 :

wget -O large-dataset.json http://data.wien.gv.at/daten/wfs?service=WFS&request=GetFeature&version=1.1.0&typeName=ogdwien:BAUMOGD&srsName=EPSG:4326&outputFormat=json

请注意下载大小!


EDIT: 我发现meld 有些作用。应用程序不同时加载整个文件以阻塞用户界面, 而是依次读取文件内容 。

问题回答

Python JSON 模块( python -mjson.tool )也可以做到这一点,例如:

cat myjsonfile.json | python -m json.tool > pretty.json

如果您只想 < general> 视觉化(和搜索) a json file (和搜索) a firfox&utm_source=google&utm_medial=cpc&utm_medial_camp=Firefox-Brand-DE-EN-GGL-ExactL-Exact&utm_term=ferfox&utm_content=A144_A203_A006316&&gclid=EIaQobchmiqSpNeqSpNe24AIVszLTC0VwCxEAAYASAAAAEKFX_D_BwE&glclsrc=aw.ds" rel=" noreferrerer" > > > frefox 做一个相当不错的工作。 I don hit have > I have a hand hand a a do a do a make a man a mot > fcode > 文件, but it a. but a a a do a do a

只要拖动 JSON 文件到 Firefox, 或者运行 :

firefox your_ file.json , firefox your_file.json

jq is a lightweight commandline JSON processor and works well! for this you need to install jq with the command below(if you are using apt package manager).

sudo apt-get install jq

下命令会让json 漂亮到一个新的文件。

 jq  .  non-pretty.json > pretty.json

我们也可以用jq过滤json, 我发现它很有帮助, 同时处理大型的Geojson文件, 例如低于命令只保存第一个特性的属性 。

jq  .features[0].properties  geojson_file.json > pretty.json

希望这能帮上忙!

您有 KDE 或其他视觉环境吗? 如果有, 您是否尝试过使用 铬扩展名 < a href="https://chrome.google.com/webstore/detail/chklaanhfefbnpoihbbnpoihckbnehkbhakgownmc" rel = "nofollow" >JsonView ?

核心使用是大json 格式化。 我用 25MB json 文件测试了 Chrome 扩展 JSON View 25MB json 文件 。 它在装入本地文件或网络时崩溃 。 崩溃后, JSON 将不会获得格式化, 在查看 JSON 视图选项时, 您将得到一个崩溃信息 。 我还尝试了类似的火狐 。 我也尝试了在线 json 格式化 。

找到了此库 - < a href=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

一个缺点, 要安装和运行, 一个人应该更熟悉爪哇和玛文。

要安装 & amp; 运行 :

git clone https://github.com/bazaarvoice/jsonpps.git
mvn clean package
cd target 
java -jar jsonpps-1.2-SNAPSHOT.jar -o /path/to/output.json /path/to/largeInput.json

这一解决办法不限于Ubuntu,它应就任何操作系统开展工作。





相关问题
Add a changing icon to Ubuntu Panel

What would be the most simple way of adding and changing an icon in the Ubuntu (Gnome) Panel? I m looking for something as simple as shell scripting, but I m not restricted to that. Will write a ...

Configuring kernel

After create a new system call, how to update the kernel? I tried these lines, make-kpkg clean fakeroot make-kpkg -initrd -append-to-version=-custom kernel_image kernel_headers But Ubuntu asked me ...

save Exceptions to file in python

I want to save all following Exceptions in a file. The reason why I need this is because the IDLE for python 3.1.1 in Ubuntu raises an Exception at calltipps, but close to fast, that it isn t readble. ...

How can i monitor system statistics in kubuntu using Java?

i am doing a project related to configuration and memory analyzer for kubuntu. i want to display the system statistics information like CPU usage, RAM usage and proceses etc. graphically using an ...

How to pass "--external-locking" for mysqld in Ubuntu

I would like to start my mysql server with the --external-locking option. As mysqld is run by the /etc/init.d/mysql script ubuntu (karmic), I guess that s where I should set this "--external-locking" ...

"g++" and "c++" compiler

I just found on my Ubuntu, there are two different C++ compilers: /usr/bin/g++ and /usr/bin/c++. I am not familiar with the latter, but man c++ just jumps to the manpage of gcc. I wonder what is their ...

热门标签