Skip to content

Commit 1fc6b4c

Browse files
author
Chris Santero
committed
add test helper to minify json
1 parent 10c7537 commit 1fc6b4c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

JSONAPI.Tests/Json/JsonHelpers.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Text.RegularExpressions;
2+
3+
namespace JSONAPI.Tests.Json
4+
{
5+
static class JsonHelpers
6+
{
7+
// http://stackoverflow.com/questions/8913138/minify-indented-json-string-in-net
8+
public static string MinifyJson(string input)
9+
{
10+
return Regex.Replace(input, "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)