我已按以下格式请求供应商正文:
{
"supplier": {
"supplierData": {
"supplierAddress": {
"street": "abc",
"postCode": "1234",
"city1": "abcd",
"country": "DE",
"region": "BW"
},
"location": {
"locationID": "1234",
"locationName": "South Africa "
},
"lastUpdatedDateTime": "2022-06-28T10:07:37.000Z"
}
}
}
能够使用它,并且需要知道如何将Location对象的以下主体请求作为空值而不是字符串使用:
{
"supplier": {
"supplierData": {
"supplierAddress": {
"street": "abc",
"postCode": "1234",
"city1": "abcd",
"country": "DE",
"region": "BW"
},
"location": "null",
"lastUpdatedDateTime": "2022-06-28T10:07:37.000Z"
}
}
}
我们该怎么做。
1条答案
按热度按时间mrfwxfqh1#
我假设你想把它解析成一个定义好的POJO,并且假设
Location
必须是Object
,否则(string
),它是null
,那么你可以尝试解析它: