Mozilla 休息客户端 post json object
Mozilla rest client post json object
我正在使用 Mozilla fire fox
add-on RESTClient
来测试我的 web-services。到目前为止,我使用 POST
方法通过设置 header Content-Type:application/x-www-form-urlencoded
和请求 body 中由 &
分隔的数据,例如id=1&title=abc
但现在我想 POST
JSON
object 使用相同的服务。示例 object 如下:
[
{
"id": 4
"type":"alpha",
"title":"Title1"
}
]
或
[
{
"id": 4
"type":"alpha",
"title":"Alpha"
},
{
"id": 5
"type":"beta",
"title":"Beta"
},
{
"id": 6
"type":"gama",
"title":"Gama"
}
]
或
[
{
"id": 5,
"type":"beta",
"title":"Sample beta",
"children":[{
"id": 6,
"type":"betachild",
"title":"Beta child 1"
},
{
"id": 7,
"type":"betachild",
"title":"Beta child 2"
},
{
"id": 8,
"type":"betachild",
"title":"Beta child 3"
}
]
}
]
或
[
{
"id": 5,
"type":"beta",
"title":"Sample beta",
"children":[{
"id": 6,
"type":"betachild",
"title":"Beta child 1"
},
{
"id": 7,
"type":"betachild",
"title":"Beta child 2"
},
{
"id": 8,
"type":"betachild",
"title":"Beta child 3"
}
]
},
{
"id": 9,
"type":"beta",
"title":"Sample gama",
"children":[{
"id": 10,
"type":"gamachild",
"title":"Gama child 1"
},
{
"id": 11,
"type":"gamachild",
"title":"Gama child 2"
},
{
"id": 12,
"type":"gamachild",
"title":"Gama child 3"
}
]
}
]
如何使用 RESTClient
add-on 在 POST
请求中传递这样的 JSON
object?
设置内容类型为Content-type:application/json
我正在使用 Mozilla fire fox
add-on RESTClient
来测试我的 web-services。到目前为止,我使用 POST
方法通过设置 header Content-Type:application/x-www-form-urlencoded
和请求 body 中由 &
分隔的数据,例如id=1&title=abc
但现在我想 POST
JSON
object 使用相同的服务。示例 object 如下:
[
{
"id": 4
"type":"alpha",
"title":"Title1"
}
]
或
[
{
"id": 4
"type":"alpha",
"title":"Alpha"
},
{
"id": 5
"type":"beta",
"title":"Beta"
},
{
"id": 6
"type":"gama",
"title":"Gama"
}
]
或
[
{
"id": 5,
"type":"beta",
"title":"Sample beta",
"children":[{
"id": 6,
"type":"betachild",
"title":"Beta child 1"
},
{
"id": 7,
"type":"betachild",
"title":"Beta child 2"
},
{
"id": 8,
"type":"betachild",
"title":"Beta child 3"
}
]
}
]
或
[
{
"id": 5,
"type":"beta",
"title":"Sample beta",
"children":[{
"id": 6,
"type":"betachild",
"title":"Beta child 1"
},
{
"id": 7,
"type":"betachild",
"title":"Beta child 2"
},
{
"id": 8,
"type":"betachild",
"title":"Beta child 3"
}
]
},
{
"id": 9,
"type":"beta",
"title":"Sample gama",
"children":[{
"id": 10,
"type":"gamachild",
"title":"Gama child 1"
},
{
"id": 11,
"type":"gamachild",
"title":"Gama child 2"
},
{
"id": 12,
"type":"gamachild",
"title":"Gama child 3"
}
]
}
]
如何使用 RESTClient
add-on 在 POST
请求中传递这样的 JSON
object?
设置内容类型为Content-type:application/json