Retrofit2获取要在发布中发送的对象的JSON表示形式

时间:2019-07-01 12:52:06

标签: json retrofit2 pojo

我正在使用Retrofit向REST服务发送数据/从REST服务接收数据。

现在我必须发布一个像这样的复杂JSON:

{
    "UTA_param": [
    {
        "UTA_on": "09:00",
        "UTA_off": "18:00",
        "muF": 90,
        "unit_meas": 12,
        "WifiON" : "15:00",
        "WifiOFF" : "18:00"
    }
    ],
    "sensors": [
    {
        "device_id": "ADU001x",
        "measures": [
            {"acquisition_date":"2018-04-02T02:41:56.222Z","PM10": 38,"PM2_5": 540,"temp": 26.5,"Hum": 46.5,"batt_lev": 8.3,"mem_lev": 512},
            {"acquisition_date":"2018-04-02T02:41:56.222Z","PM10": 38,"PM2_5": 540,"temp": 26,"Hum": 46,"batt_lev": 8.3,"mem_lev": 512},
            {"acquisition_date":"2018-04-02T02:41:56.222Z","PM10": 38,"PM2_5": 540,"temp": 26,"Hum": 46,"batt_lev": 8.3,"mem_lev": 512},
            {"acquisition_date":"2018-04-02T02:41:56.222Z","PM10": 38,"PM2_5": 540,"temp": 26,"Hum": 46,"batt_lev": 8.3,"mem_lev": 512},
            {"acquisition_date":"2018-04-02T02:41:56.222Z","PM10": 38,"PM2_5": 540,"temp": 26,"Hum": 46,"batt_lev": 8.3,"mem_lev": 512},
            {"acquisition_date":"2018-04-02T02:41:56.222Z","PM10": 38,"PM2_5": 540,"temp": 26,"Hum": 46,"batt_lev": 8.3,"mem_lev": 512}
        ]
    },
    {
        "device_id": "ADU002x",
        "measures": [
            {"acquisition_date": "2018-04-03T14:41:56.222Z","PM10": 67,"PM2_5": 1040,"temp": 26,"Hum": 46,"batt_lev": 8.3,"mem_lev": 512}
        ]
    }
    ]
}

我使用了漂亮的jsonschema2pojo网站(http://www.jsonschema2pojo.org/)来获取实现该JSON的pojo,但我希望在将其发送到服务器之前看到该库产生的JSON。

在哪里可以找到它?

谢谢

最好的问候

0 个答案:

没有答案