英文:
How to manipulate data through postman with spring boot
问题
以下是在Postman中的请求负载:
{
"name":"xyz",
"username":"xyz@123",
"address":{
"street":{
"locations":[
{
"lng":-12.2342,
"lat":23.1234
},
{
"lng":-12.2342,
"lat":23.1234
},
{
"lng":-12.2342,
"lat":23.1234
}
]
}
}
}
我有一个数据库模式如下:
id(pk) string
name string
username string
geometry string
在上述模式中,geometry字段包含以字符串格式的lng/lat数组,例如 polygon(-12.2342 23.1234,-12.2342 23.1234,-12.2342 23.1234)
。那么,我该如何将上述请求负载中的lat/lng数组转换为字符串类型,以便我可以在Spring Boot中将其存储在MySQL数据库中,数据类似于 polygon(-12.2342 23.1234,-12.2342 23.1234,-12.2342 23.1234)
?
英文:
Following are request payload in postman:
{
"name":"xyz",
"usename":"xyz@123",
"address":{
"street":{
"locations":[{
"lng":-12.2342,
"lat":23.1234
},
{
"lng":-12.2342,
"lat":23.1234
},
{
"lng":-12.2342,
"lat":23.1234
}]
}
}
}
and i have database schema like
id(pk)string
name String
username String
geometry String
in above schema geometry field contains array of lng/lat in string format
like polygon(-12.2342 23.1234,-12.2342 23.1234,-12.2342 23.1234)
so how can i convert above request payload array of lat/lng to string type so that i can store it in mysql database like data polygon(-12.2342 23.1234,-12.2342 23.1234,-12.2342 23.1234)
with springboot?
答案1
得分: 0
-
将负载中的呼叫位置称为 locations,因为它是一个数组:
-
有如下实体:
class Location{
double long;
double lat;
}
class Street {
List<Location> locations;
}
class Address {
Street street;
}
class RequestData {
String name;
String userName;
Address address;
}
英文:
-
Call location in payload as locations because its array:
-
Have entities like below:
class Location{
double long;
double lat;
}
class Street {
List<Location> locations;
}
class Address {
Street street;
}
class RequestData {
String name;
String userName;
Address address;
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论