Example #1
0
 it('should test formatting json array of objects', function() {
   var json = '[{"hello":"world"},{"foo":500.0}]';
   var result = jsfmt.formatJSON(json, {});
   result.should.eql('[{\n  "hello": "world"\n  }, {\n  "foo": 500.0\n}]');
 });
Example #2
0
 it('should test formatting json object', function() {
   var json = '{"hello":"world"}';
   var result = jsfmt.formatJSON(json, {});
   result.should.eql('{\n  "hello": "world"\n}');
 });
Example #3
0
 it('should test formatting json array', function() {
   var json = '["hello","world"]';
   var result = jsfmt.formatJSON(json, {});
   result.should.eql('["hello", "world"]');
 });
Example #4
0
 it('should correctly format with trailing new line', function() {
   var json = '{"a":1,"b":"c"}\n';
   var result = jsfmt.formatJSON(json, {});
   result.should.eql('{\n  "a": 1,\n  "b": "c"\n}\n');
 });