如何编写http请求体json(For Java)

时间:2018-03-10 21:35:41

标签: java http

我想在Java中使用JSON创建一个简单的HTTP Post。

  

我们说网址为https://authserver.mojang.com

     

并且它包含值{"用户名":"用户名","密码":"密码"}

我将如何创建POST的语法?

顺便说一下,这是一个自定义的Minecraft客户端(此方法用于登录)

这将如何添加此Payload

{
    "agent": {                              // defaults to Minecraft
        "name": "Minecraft",                // For Mojang's other game Scrolls, "Scrolls" should be used
        "version": 1                        // This number might be increased
                                            // by the vanilla client in the future
    },
    "username": "mojang account name",      // Can be an email address or player name for
                                            // unmigrated accounts
    "password": "mojang account password",
    "clientToken": "client identifier",     // optional
    "requestUser": true                     // optional; default: false; true adds the user object to the response
}

0 个答案:

没有答案