On Thu, 14 Jan 2016 08:17:20 GMT, Suliman wrote:
{"error":{"isAuthorized":false,"password":"wrongPassword"},"status":"fail"}
I would like to do:
"status":"fail", {"error":{"isAuthorized":false,"password":"wrongPassword"}}
You can use a struct and serializeToJsonString
(or pass the struct to res.writeJsonBody
):
struct PasswordError {
bool isAuthorized;
string password;
}
struct ErrorStatus {
string status;
PasswordError error;
}
logInfo(%s, ErrorStatus("fail", PasswordError(false, "wrongPassword")).serializeToJsonString());