Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a json in the below format and it will be big in size approx 2 mb. How can I compress this using c#? my project is a web api project. I want compress my json in the c# (web api) and send it to the browser client which is built on angular js. so in the javascript end , I have to decompress.

JavaScript
{
  "firstName": "John",
  "lastName": "Smith",
  "age": 25,
  "address":
  {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postalCode": "10021"
  },
  "phoneNumber":
  [
    {
      "type": "home",
      "number": "212 555-1234"
    },
    {
      "type": "fax",
      "number": "646 555-4567"
    }
  ]
}
Posted
Updated 24-Nov-14 9:34am
v2
Comments
Sergey Alexandrovich Kryukov 24-Nov-14 15:53pm    
With such a small portion of data, why would you think the compression may pay off?
—SA
Member 10131753 24-Nov-14 16:28pm    
This is a sample json which has 1 record, like wise my json will contain data with 100000+ records.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900