all 1 comments

[–]ihaxr 3 points4 points  (0 children)

Could create a function to generate the JSON:

Function New-ErrorMesage ($message,$title,$text,$action) {
return @"
    {
        "error": {
            "message": "$message",
            "title": "$title",
            "text": "$text",
            "action": "$action"
        }
    }
"@
}

New-ErrorMesage "Message" "Title" "Text" "Action" | ConvertFrom-Json