将对象列表作为 URL 参数传递

Passing object list as URL parameters

我想将 Boxes 对象列表作为查询参数传递给 URL。例如:

[
{
    "text": "One does not simply",
    "x": 10,
    "y": 10,
    "width": 548,
    "height": 100,
    "color": "#ffffff",
    "outline_color": "#000000"
},
{
    "text": "Make custom memes on the web via imgflip API",
    "x": 10,
    "y": 225,
    "width": 548,
    "height": 100,
    "color": "#ffffff",
    "outline_color": "#000000"
    }
]

我不知道该怎么做,所以我尝试了类似的方法,但没有用。

https://api.imgflip.com/caption_image?template_id=615795&username=dssfdfd&password=sdssfs&text0=hjfdksl&max_font_size=30&boxes=[ 
{
    "text": "One does not simply",
    "x": 10,
    "y": 10,
    "width": 548,
    "height": 100,
    "color": "#ffffff",
    "outline_color": "#000000"
},
{
    "text": "Make custom memes on the web via imgflip API",
    "x": 10,
    "y": 225,
    "width": 548,
    "height": 100,
    "color": "#ffffff",
    "outline_color": "#000000"
    }
]

知道怎么做吗?感谢您的帮助。

您的框数组查询字符串应该是这样的,请注意“#”已从颜色 属性 中删除,因为它们通常会干扰结果。您可以将它们添加回 API 侧。

boxes[0].text=One does not simply&boxes[0].x=10&boxes[0].y=10&boxes[0].width=548&boxes[0].height=100&boxes[0].color=ffffff&boxes[0].outline_color=000000&boxes[1].text=Make custom memes on the web via imgflip API&boxes[1].x=10&boxes[1].y=225&boxes[1].width=548&boxes[1].height=100&boxes[1].color=ffffff&boxes[1].outline_color=000000