Hi I need help once again with Json management.
I'm trying to send a list of Json as response from my rocket server, the output should look like as follows:
[
{"target": "red","location": [[622, 1502352659111],[555,1502352679000],[378, 1502352699000],[365, 1502352709000]]}
{"target": "blue","location": [[622, 1502352659111],[555,1502352679000],[378, 1502352699000],[365, 1502352709000]]}
]
At the moment I'm cheating in this way but it is not even close to an acceptable solution. Do you have any tips?
#[derive(Serialize, Debug)]
struct Output {
target: String,
location: ??
}
#[post("/query")]
fn querypost() -> String {
let output = "[{
\"target\": \"red\",
\"location\": [
[622, 1502352659111],
[555, 1502352679000],
[378, 1502352699000],
[365, 1502352709000]]}]";
format!("{}", output)
}