使用bash [duplicate]从JSON中提取数据

问题描述 投票:0回答:2

这个问题在这里已有答案:

我有这个输入

[{"email":"etu@etu"},{"email":"hg"},{"email":"ismail"}]

我想使用bash只提取电子邮件中的值。

bash shell
2个回答
2
投票

只需使用jq

echo '[{"email":"etu@etu"},{"email":"hg"},{"email":"ismail"}]' | jq -r '.[].email'

输出:

etu@etu
hg
ismail

-2
投票

我建议您使用一些unix工具,并在bash过程中调用它。

看看这个:json command line processor

你可能想调查这个,你可能会很高兴。

© www.soinside.com 2019 - 2024. All rights reserved.