Skip to content

Instantly share code, notes, and snippets.

@mattcanty
Last active August 29, 2015 14:02
Show Gist options
  • Save mattcanty/985b49d90d9efb0b24bb to your computer and use it in GitHub Desktop.
Save mattcanty/985b49d90d9efb0b24bb to your computer and use it in GitHub Desktop.
Minify Json
public static string MinifyJson(string unminifiedJson)
{
return Regex.Replace(unminifiedJson, "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
}
@mattcanty
Copy link
Author

All credit to Mike Samuel over at Stack Overflow - http://stackoverflow.com/a/8913186/966609

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment