Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

320 B
Raw Blame
export function isNonEmptyJson(jsonString?: string | null): boolean {
  if (!jsonString) {
    return false;
  }

  try {
    const parsed = JSON.parse(jsonString);

    return (
      parsed !== null &&
      typeof parsed === "object" &&
      Object.keys(parsed).length > 0
    );
  } catch {
    return false;
  }
}