We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/KasarLabs/snak'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
validateJson.ts•465 B
/**
* Validates if the given string content is a valid JSON.
*
* @param content - The string to be validated as JSON.
* @returns A Promise that resolves to true if the content is valid JSON, false otherwise.
*/
export async function validateJson(content: string): Promise<boolean> {
try {
if (!content.startsWith('{') && !content.startsWith('[')) {
return false;
}
JSON.parse(content);
return true;
} catch {
return false;
}
}