Results 1 to 5 of 5

Thread: Ext.Json.encode not passing all argument to native strinify

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Sep 2009
    Location
    Denver
    Posts
    51
    Vote Rating
    2
      0  

    Default Ext.Json.encode not passing all argument to native strinify

    The 2nd and 3rd optional argument don't appear to be passed to native stringify method.

    Code:
    Ext.USE_NATIVE_JSON = true;
    
    Calling Ext.JSON.encode 
    
    console.log(Ext.JSON.encode({prop1: 'test1', prop2: 'test2',}, null, 4)); 
    
    
    {"prop1":"test1","prop2":"test2"}
    
    
    Calling JSON.stringify dirrectly
    
    console.log(JSON.stringify({prop1: 'test1', prop2: 'test2',}, null, 4)); 
    
    
    {
        "prop1": "test1",
        "prop2": "test2"
    }
    *EDIT
    Additional notes from McQuack_82:
    Code:
    me.encode = function(object, replacer, space) {
        if (!encodingFunction) {
            // setup encoding function on first access
            encodingFunction = isNative() ? JSON.stringify : me.encodeValue;
        }
        return encodingFunction(arguments);
    };
    https://developer.mozilla.org/en-US/...JSON/stringify

  2. #2
    Sencha User
    Join Date
    Sep 2009
    Location
    Denver
    Posts
    51
    Vote Rating
    2
      0  

    Default I think the code in encode needs changed to following

    Code:
    me.encode = function(object, replacer, space) {
    	if (!encodingFunction) {
    		// setup encoding function on first access
    		encodingFunction = isNative() ? JSON.stringify : me.encodeValue;
    	}
    	return encodingFunction(arguments);
    };
    https://developer.mozilla.org/en-US/...JSON/stringify

  3. #3
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,154
    Vote Rating
    247
      0  

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  4. #4
    Sencha - QA Team ryansmith's Avatar
    Join Date
    Oct 2012
    Location
    Lawrence, KS
    Posts
    2
    Vote Rating
    0
      0  

    Default

    Hi McQuack_82

    Can you tell us what version of ExtJS your using?

    Thanks

  5. #5
    Sencha User
    Join Date
    Sep 2009
    Location
    Denver
    Posts
    51
    Vote Rating
    2
      0  

    Default version in test case

    the version in the test case extjs 4.1.1 gpl

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •