Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3362032
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:13:26+00:00 2026-05-18T03:13:26+00:00

I see a lot of references to compressed JSON when it comes to different

  • 0

I see a lot of references to “compressed JSON” when it comes to different serialization formats. What exactly is it? Is it just gzipped JSON or something else?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T03:13:27+00:00Added an answer on May 18, 2026 at 3:13 am

    Compressed JSON removes the key:value pair of json’s encoding to store keys and values in seperate parallel arrays:

    // uncompressed
    JSON = {
      data : [
         { field1 : 'data1', field2 : 'data2', field3 : 'data3' },
         { field1 : 'data4', field2 : 'data5', field3 : 'data6' },
         .....
      ]
    };
     
    //compressed
    JSON = {
        data : [ 'data1','data2','data3','data4','data5','data6' ],
        keys : [ 'field1', 'field2', 'field3' ]
    };
    

    This method of usage i found here

    Content from link (http://www.nwhite.net/?p=242)

    rarely find myself in a place where I am writing javascript applications that use AJAX in its pure form. I have long abandoned the ‘X’ and replaced it with ‘J’ (JSON). When working with Javascript, it just makes sense to return JSON. Smaller footprint, easier parsing and an easier structure are all advantages I have gained since using JSON.

    In a recent project I found myself unhappy with the large size of my result sets. The data I was returning was tabular data, in the form of objects for each row. I was returning a result set of 50, with 19 fields each. What I realized is if I augment my result set I could get a form of compression.

    // uncompressed

    JSON = {
      data : [
         { field1 : 'data1', field2 : 'data2', field3 : 'data3' },
         { field1 : 'data4', field2 : 'data5', field3 : 'data6' },
         .....
      ]
    };
    

    //compressed

    JSON = {
        data : [ 'data1','data2','data3','data4','data5','data6' ],
        keys : [ 'field1', 'field2', 'field3' ]
    };
    

    I merged all my values into a single array and store all my fields in a separate array. Returning a key value pair for each result cost me 8800 byte (8.6kb). Ripping the fields out and putting them in a separate array cost me 186 bytes. Total savings 8.4kb.

    Now I have a much more compressed JSON file, but the structure is different and now harder to work with. So I implement a solution in Mootools to make the decompression transparent.

    Request.JSON.extend({
     
        options : {
            inflate : []
        }
     
    });
    
    
    
    
    Request.JSON.implement({
     
        success : function(text){
            this.response.json = JSON.decode(text, this.options.secure);
            if(this.options.inflate.length){
                this.options.inflate.each(function(rule){
                    var ret = ($defined(rule.store)) ? this.response.json[rule.store] : this.response.json[rule.data];
                    ret = this.expandData(this.response.json[rule.data], this.response.json[rule.keys]);
                },this);
            }
            this.onSuccess(this.response.json, text);
        },
     
        expandData : function(data,keys){
            var arr = [];
            var len = data.length; var klen = keys.length;
            var start = 0; var stop = klen;
            while(stop < len){
                arr.push( data.slice(start,stop).associate(keys) );
                start = stop; stop += klen;
            }
            return arr;
        }
     
    });
    
    Request.JSON now has an inflate option. You can inflate multiple segments of your JSON object if you so desire.
    
    Usage:
    
    new Request.JSON({
           url : 'url',
           inflate : [{ 'keys' : 'fields', 'data' : 'data' }]
           onComplete : function(json){}
    });
    

    Pass as many inflate objects as you like to the option inflate array. It has an optional property called ’store’ If set the inflated data set will be stored in that key instead.

    The ‘keys’ and ‘fields’ expect strings to match a location in the root of your JSON object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see a lot of different point of views on internet concerning meta tags
I see a lot of references to this in Java software discussions specifically those
I see lot of new machines and laptops now having 64 bit hardware and
I see a lot of JDK 1.6 notes about how to open an HTML
I see a lot of people are using code under viewDidLoad to be able
I see a lot of this: 06-19 17:29:11.911: DEBUG/dalvikvm(10028): GC_FOR_MALLOC freed 729K, 54% free
I see a lot of debate going back and forth on which language to
I see a lot of questions, both here on SO and elsewhere, about maintaining
I see a lot of the multi-core information on the web applied to desktop
I see a lot in autoconf code about stuff being dnl'ed and not dnl'ed.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.