Created
August 7, 2014 13:56
-
-
Save mattbrailsford/851d210b1c3edcd3b7f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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