简体   繁体   English

使用sed从JSON响应中获取确切值

[英]Using sed to get an exact value from a JSON response

I'm getting this string data from curl command 我从curl命令获取此字符串数据

 {"password": [["passwordreal", "2035/01/01 00:00"]], "user": "user1", "address": "kobebkokoko.net"}

How do I get passwordreal using sed ? 如何使用sed获得passwordreal

For example, 例如,

curl xxxx | sed -n '/ *"password"' => Been working on this long hours.

With jq: 与jq:

| jq -r '.password[]|.[0]'

Output: 输出:

passwordreal

Use a tool that can safely handle JSON. 使用可以安全处理JSON的工具。 sed is not one of them. sed不是其中之一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM