Skip to content

Instantly share code, notes, and snippets.

@mattbrailsford
Created August 7, 2014 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mattbrailsford/851d210b1c3edcd3b7f9 to your computer and use it in GitHub Desktop.
Save mattbrailsford/851d210b1c3edcd3b7f9 to your computer and use it in GitHub Desktop.
public static class StringExtensions
{
public static bool DetectIsJson(this string input)
{
input = input.Trim();
if (input.StartsWith("{") && input.EndsWith("}"))
return true;
if (input.StartsWith("["))
return input.EndsWith("]");
else
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment