盒子
盒子

httpie嵌套json和发送数组

今天遇到一个需求是这样子的,

httpie结构需求

由于不好查, 所以这里贴出来.
官网结果:

1
➜ imClientServer git:(login) http POST http://localhost:8080/sendmsg target_type=users target:='["u1", "u2", "u3"]' from=admin msg:='{"type":"txt","msg":"这才是消息内容"}'

后台接受到的结果映射json

1
2
3
4
5
6
7
8
9
10
11
12
13
"content": {
"from": "admin",
"msg": {
"msg": "这才是消息内容",
"type": "txt"
},
"target": [
"u1",
"u2",
"u3"
],
"target_type": "users"
}