如何使用IDEA格式化JSON数据
Posted CodeJiao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何使用IDEA格式化JSON数据相关的知识,希望对你有一定的参考价值。
1. 如何使用IDEA格式化JSON数据
1.1 原JSON格式数据准备
假设现在有这么一段JSON格式的数据:
- [“dataCode”:“file_content_275eaa19-faa7-12ae-19f9-916428aef809”,“dataValue”:“收拾收拾”,“dataCode”:“file_number_9caeb5aa-f64a-4a98-3efe-76c918443489”,“dataValue”:“1”,“dataCode”:“file_number_0173f2bc-1b78-7908-b9f4-ddbfaf3767fe”,“dataValue”:“2”,“dataCode”:“file_content_5dc1e625-311a-e609-cd99-800c0c567b0d”,“dataValue”:“3234”,“dataCode”:“C”,“dataValue”:"[“uid”:“wu_1fhp8ha1dkv716se1bq01fat1qdd0”,“size”:34487,“name”:“2020.05.09_中国电信股份有限公司重庆分公司_050001900111_22027316.pdf”,“id”:“UPLOADED_WU_FILE_0”,“url”:"/fom/api/webUploader/download/cd9dbc4be3e0c970298c0e832e3fc35d/2020.05.09_中国电信股份有限公司重庆分公司_050001900111_22027316.pdf",“md5”:“cd9dbc4be3e0c970298c0e832e3fc35d”,“uid”:“wu_1fhp8hfgg19as1km11n4edpb1cdb0”,“size”:116322,“name”:“安全台帐.png”,“id”:“UPLOADED_WU_FILE_1”,“type”:“pic”,“url”:"/fom/api/webUploader/download/f30d2862b8d048272ba2fb29bb04d90a/安全台帐.png",“md5”:“f30d2862b8d048272ba2fb29bb04d90a”,“uid”:“wu_1fhppd49p1njb1oaor5u1v9r113r0”,“size”:3102,“name”:“画画.jpg”,“id”:“UPLOADED_WU_FILE_4”,“type”:“pic”,“url”:"/fom/api/webUploader/download/c54059ffd016267f68cb04e5ed0ce4c2/画画.jpg",“md5”:“c54059ffd016267f68cb04e5ed0ce4c2”,“uid”:“wu_1fhppd4elf41t4l1ars7l2g890”,“size”:13388,“name”:“旺旺大头照2.jpg”,“id”:“UPLOADED_WU_FILE_9”,“type”:“pic”,“url”:"/fom/api/webUploader/download/ec8f4de2667180065d0b67abd26937c3/旺旺大头照2.jpg",“md5”:“ec8f4de2667180065d0b67abd26937c3”,“uid”:“wu_1fhppd4en1dceufl1ele92ntvf0”,“size”:14056,“name”:“旺旺大头照1.jpg”,“id”:“UPLOADED_WU_FILE_8”,“type”:“pic”,“url”:"/fom/api/webUploader/download/c24a1f84af8d21134509bf0fe038ac4b/旺旺大头照1.jpg",“md5”:“c24a1f84af8d21134509bf0fe038ac4b”,“uid”:“wu_1fhppd4deksh1o0f1fc3sdm14a70”,“size”:9134,“name”:“旺旺.jpg”,“id”:“UPLOADED_WU_FILE_7”,“type”:“pic”,“url”:"/fom/api/webUploader/download/602f29f4bca69b4ca42041b35715b935/旺旺.jpg",“md5”:“602f29f4bca69b4ca42041b35715b935”,“uid”:“wu_1fhppd4fp16fmet4pre1qkphe20”,“size”:259663,“name”:“英雄联盟.jpg”,“id”:“UPLOADED_WU_FILE_11”,“type”:“pic”,“url”:"/fom/api/webUploader/download/43424fcdd624969ac823c8e7a923c087/英雄联盟.jpg",“md5”:“43424fcdd624969ac823c8e7a923c087”,“uid”:“wu_1fhppd4fehdek0u7d01rultfb0”,“size”:566968,“name”:“枫林.jpg”,“id”:“UPLOADED_WU_FILE_3”,“type”:“pic”,“url”:"/fom/api/webUploader/download/6b49da920b26dad07fa0a1e1eab599a1/枫林.jpg",“md5”:“6b49da920b26dad07fa0a1e1eab599a1”,“uid”:“wu_1fhppd4gphv3oq3o151sou1n430”,“size”:652859,“name”:“薰衣草.jpg”,“id”:“UPLOADED_WU_FILE_10”,“type”:“pic”,“url”:"/fom/api/webUploader/download/f63e283c3d4e6de563dd7237d48af4ca/薰衣草.jpg",“md5”:“f63e283c3d4e6de563dd7237d48af4ca”,“uid”:“wu_1fhppd4hvpa45n61tl21nosqi00”,“size”:304822,“name”:“童话镇.jpg”,“id”:“UPLOADED_WU_FILE_6”,“type”:“pic”,“url”:"/fom/api/webUploader/download/fb23bf67e10fa0acb2634580df796c06/童话镇.jpg",“md5”:“fb23bf67e10fa0acb2634580df796c06”,“uid”:“wu_1fhppd4hr1ar7rfuamq1c2kp0u0”,“size”:459593,“name”:“风铃.jpg”,“id”:“UPLOADED_WU_FILE_2”,“type”:“pic”,“url”:"/fom/api/webUploader/download/7ca75b912ac11864fe5756e78f790527/风铃.jpg",“md5”:“7ca75b912ac11864fe5756e78f790527”,“uid”:“wu_1fhppd4n91npm131413u4dbvano0”,“size”:325408,“name”:“神奇的石头.jpg”,“id”:“UPLOADED_WU_FILE_5”,“type”:“pic”,“url”:"/fom/api/webUploader/download/d9c937309c27b5edaa79fe11c0433026/神奇的石头.jpg",“md5”:“d9c937309c27b5edaa79fe11c0433026”,“uid”:“wu_1fhppd4n8mpeidu1lo319811eei0”,“size”:479554,“name”:“大漠孤烟直,长河落日圆.jpg”,“id”:“UPLOADED_WU_FILE_1”,“type”:“pic”,“url”:"/fom/api/webUploader/download/aa5aa9da748df4578e3930bce1b331ed/大漠孤烟直,长河落日圆.jpg",“md5”:“aa5aa9da748df4578e3930bce1b331ed”,“uid”:“wu_1fhppd4p67rof561akm19gr197b0”,“size”:286563,“name”:“schoolNight.jpg”,“id”:“UPLOADED_WU_FILE_0”,“type”:“pic”,“url”:"/fom/api/webUploader/download/974690526dc18f12eff4f07f2c26d43f/schoolNight.jpg",“md5”:“974690526dc18f12eff4f07f2c26d43f”,“uid”:“wu_1fhprsoji1i45am9dhv1eg7590”,“size”:183641,“name”:“3.png”,“id”:“UPLOADED_WU_FILE_0”,“type”:“pic”,“url”:"/fom/api/webUploader/download/c3ffc4313c64ce1f2286ab49a7f58982/3.png",“md5”:“c3ffc4313c64ce1f2286ab49a7f58982”]"]
1.2 格式化上面的JSON数据
这么看着显然是不太方便的,那么我们怎么格式化显示这些数据呢?这时候万能的IDEA就派上用场了
1.2.1 下载Save Actions插件,这个插件可以帮助我们格式化文件(除了格数化文本以外还可以格式化代码)
1.2.2 在IDEA中随便找一个目录新建一个JSON文件,把所需要格式化的JSON字符串拷贝上去
这样就实现了格式化JSON格式文件
以上是关于如何使用IDEA格式化JSON数据的主要内容,如果未能解决你的问题,请参考以下文章