.Maui Blog

Javascript – check if a string is a valid JSON

function IsJson(myString) {
    try {
        JSON.parse(myString);
    } 
    catch (err) {
        return false;
    }
    return true;
}
Exit mobile version