jsonParseWalkTest.js 1.2 KB

1234567891011121314151617181920212223242526
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. WScript.Echo("-------Named Type Test Start------------------");
  6. var obj = JSON.parse('{"2a":"foo"}', function(key, value){
  7. WScript.Echo(key, ':', value);
  8. return value;
  9. });
  10. WScript.Echo(obj["2a"]);
  11. WScript.Echo("-------Named Type Test End--------------------");
  12. WScript.Echo("-------Simple Numeral Type Test Start---------");
  13. var obj2 = JSON.parse('{"2":"foo"}', function(key, value){
  14. WScript.Echo(key, ':', value);
  15. return value;
  16. });
  17. WScript.Echo(obj2["2"]);
  18. WScript.Echo("-------Simple Numeral Type Test End----------");
  19. WScript.Echo("-------Complex Numeral Type Test Start--------");
  20. var obj3 = JSON.parse('{"3":{"1":"foo"}}', function(key, value){
  21. WScript.Echo(key, ':', value);
  22. return value;
  23. });
  24. WScript.Echo(obj3["3"]);
  25. WScript.Echo("-------Complex Numeral Type Test End----------");