属性文件到json [英] properties file to json
本文介绍了属性文件到json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是的,我很懒.. =) 你知道一个工作属性文件到 json 转换器吗?
Yes I'm lazy .. =) do you know of a working properties file to json converter?
我得到了类似的东西
prop1=bla
pro2=bla bla
pro2=bla bla
并想神奇地从中获取一个 json =)
and want to get a json out of it magically =)
推荐答案
sed -e 's/^\([^=]*\)\s*=\s*\(.*\)/"\1": "\2",/'
假设它的格式如您上面所说,将让您完成大部分工作.
sed -e 's/^\([^=]*\)\s*=\s*\(.*\)/"\1": "\2",/'
will get you most of the way there, assuming it's formatted as you say above.
这篇关于属性文件到json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文