在以太坊编程中,往往需要压缩json文件,这时候就需要剔除json里多余的空格的和换行符,效果如下:

图(1) json文件去掉空格后,再压缩为一行

    用nodepad++打开该*.json文件,然后使用如下步骤:

1、用notepad++替换所有的行首空格

    按CTRL+H 选择正则表达式-- 查找目标:^\s+ 替换为空,如图(2)所示:

json
适用于现代 C++ 的 JSON。
图(2) 剔除所有的行首空格

2、用nodepad++替换所有的换行符

    按CTRL+H 选择正则表达式-- 查找目标:\r\n 替换为空,如图(3)所示:

图(3) 将多行内容压缩为一行

GitHub 加速计划 / js / json
43
5
下载
适用于现代 C++ 的 JSON。
最近提交(Master分支:6 个月前 )
4424a0fc Signed-off-by: Niels Lohmann <mail@nlohmann.me> 8 小时前
11aa5f94 * Make std::filesystem::path conversion to/from UTF-8 encoded JSON string explicit. Signed-off-by: Richard Musil <risa2000x@gmail.com> * Experimental: Changing C++ standard detection logic to accommodate potential corner cases. Signed-off-by: Richard Musil <risa2000x@gmail.com> * Drop C++ standard tests for compilers which do not implement required features. Signed-off-by: Richard Musil <risa2000x@gmail.com> * Drop C++ standard tests for MSVC versions which do not implement required features. Signed-off-by: Richard Musil <risa2000x@gmail.com> --------- Signed-off-by: Richard Musil <risa2000x@gmail.com> Co-authored-by: Richard Musil <risa2000x@gmail.com> 1 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐