Ad
  • Custom User Avatar

    I have try the additional argumets of JSON.stringify in FireFox, and I got this result:

    JSON.stringify({a:[{b:1},{b:2}],c:{d:{e:false}},f:[1,2,'123']}, null, '\t');
    // get the string format below:
    {
    	"a": [
    		{
    			"b": 1
    		},
    		{
    			"b": 2
    		}
    	],
    	"c": {
    		"d": {
    			"e": false
    		}
    	},
    	"f": [
    		1,
    		2,
    		"123"
    	]
    }
    

    But what I want to realize is actually the format like below(Described in kata detail), which is the coding standars in my working Group:

    {
        "a": [{
            "b": 1
        }, {
            "b": 2
        }],
        "c": {
            "d": {
                "e": false
            }
        },
        "f": [1, 2, "123"]
    }
    
    
    

    Between the "key" and the { , it should be a space instead of a '\t'

    Sorry, that's my fault to give too few descriptions or examples of this Kata... And thank you for raising the question

  • Custom User Avatar

    It is awkward that I dont know the additional arguments of JSON.stringify API. One of my friends asked me how to get string with indentation from an object. Instead of searching the solution, I write a function for him... And then, I published this Kata which is the first Kata I have published. Thank you for remainding me. Maybe I should unpublished this Kata?

  • Custom User Avatar

    "shouldn't handle any nested functions:
    Test Failed: Expected: 3, instead got: undefined"

    I got an error like this when I sumbmitted.What does this mean?