1

I 'm developing a web aplication with .net API and back end with angularjs restfull , problem I have big data json (4 mb) , is there a solution to reform the json data or compressed ? for optimized the response time

1
  • Do you really need all the data? Can't you break them down into smaller pieces? Commented May 18, 2015 at 9:53

2 Answers 2

1

There are few ways to compress JSON data 1) Instead of Using arrays of object, try to use arrays of array

Ex:

[{"name":"qwerty","mobile":"000112233","location":"NorthPole"},{"temp":"0 deg","sunrise":"qw","sunset":"er"}]

to

[["qwerty","000112233","NorthPole"],["0","qw","er"]]

2) Remove blank space in json object

3) if you want to maintain array of objects. then reduce size of variable name:

[{"n":"qwerty","m":"000112233","l":"NorthPole"},{"t":"0 deg","r":"qw","s":"er"}]

My suggestion is not to pass large weight data in webapi. use async calls to fetch data which is required on demand.

Sign up to request clarification or add additional context in comments.

Comments

1

Other than using some minification library in your server-side code, you could setup GZIP compression on the web server itself. All browsers today support GZIP and will send Accept-Encoding: deflate, gzip header, so the server would know to compress before sending the respone.

Here are links to setup compression on Apache and IIS:

http://httpd.apache.org/docs/2.0/mod/mod_deflate.html

https://technet.microsoft.com/en-us/library/cc771003(WS.10).aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.