使用HTTPie发送嵌套的JSON对象 [英] Sending nested JSON object using HTTPie

查看:383
本文介绍了使用HTTPie发送嵌套的JSON对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用HTTPie进行解析以发送一些嵌套的JSON对象,但是我找不到方法.很清楚如何发送JSON对象,而不发送嵌套对象,例如

I am trying to use HTTPie to parse to send some nested JSON object, but I can not find how. It is pretty clear how to send a JSON object but not a nested one such as

{用户":{名称":约翰" "age":10}}

{ "user": { "name": "john" "age": 10 } }

推荐答案

您可以通过stdin :

$ echo '{ "user": { "name": "john", "age": 10 } }' | http httpbin.org/post

使用:= 指定原始JSON作为值:

Or specify the raw JSON as value with :=:

$ http httpbin.org/post user:='{"name": "john", "age": 10 }'

这篇关于使用HTTPie发送嵌套的JSON对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆