Annotation of embedaddon/php/ext/json/tests/pass001.1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: JSON (http://www.crockford.com/JSON/JSON_checker/test/pass1.json)
! 3: --INI--
! 4: precision=14
! 5: --SKIPIF--
! 6: <?php
! 7: if (!extension_loaded('json')) die('skip: json extension not available');
! 8: if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
! 9: ?>
! 10: --FILE--
! 11: <?php
! 12: /* Modified to test unescaped UNICODE as keys and values.
! 13: * Modified to test numbers with exponents without a decimal point.
! 14: * Modified to test empty string values.
! 15: * Modified to test a mix of integers and strings as keys.
! 16: */
! 17: // Expect warnings about INF.
! 18: ini_set("error_reporting", E_ALL & ~E_WARNING);
! 19:
! 20: $test = "
! 21: [
! 22: \"JSON Test Pattern pass1\",
! 23: {\"object with 1 member\":[\"array with 1 element\"]},
! 24: {},
! 25: [],
! 26: -42,
! 27: true,
! 28: false,
! 29: null,
! 30: {
! 31: \"integer\": 1234567890,
! 32: \"real\": -9876.543210,
! 33: \"e\": 0.123456789e-12,
! 34: \"E\": 1.234567890E+34,
! 35: \"\": 23456789012E666,
! 36: \"E no .\": 4E12,
! 37: \"zero\": 0,
! 38: \"one\": 1,
! 39: \"space\": \" \",
! 40: \"quote\": \"\\\"\",
! 41: \"backslash\": \"\\\\\",
! 42: \"controls\": \"\\b\\f\\n\\r\\t\",
! 43: \"slash\": \"/ & \\/\",
! 44: \"alpha\": \"abcdefghijklmnopqrstuvwyz\",
! 45: \"ALPHA\": \"ABCDEFGHIJKLMNOPQRSTUVWYZ\",
! 46: \"digit\": \"0123456789\",
! 47: \"special\": \"`1~!@#$%^&*()_+-={':[,]}|;.</>?\",
! 48: \"hex\": \"\\u0123\\u4567\\u89AB\\uCDEF\\uabcd\\uef4A\",
! 49: \"unicode\": \"\\u30d7\\u30ec\\u30b9\\u30ad\\u30c3\\u30c8\",
! 50: \"プレスキット\": \"プレスキット\",
! 51: \"empty_string\": \"\",
! 52: \"true\": true,
! 53: \"false\": false,
! 54: \"null\": null,
! 55: \"array\":[ ],
! 56: \"object\":{ },
! 57: \"123\":{\"456\":{\"abc\":{\"789\":\"def\",\"012\":[1,2,\"5\",500],\"ghi\":[1,2,\"five\",50,\"sixty\"]}}},
! 58: \"address\": \"50 St. James Street\",
! 59: \"url\": \"http://www.JSON.org/\",
! 60: \"comment\": \"// /* <!-- --\",
! 61: \"# -- --> */\": \" \",
! 62: \" s p a c e d \" :[1,2 , 3
! 63:
! 64: ,
! 65:
! 66: 4 , 5 , 6 ,7 ],
! 67: \"compact\": [1,2,3,4,5,6,7],
! 68: \"jsontext\": \"{\\\"object with 1 member\\\":[\\\"array with 1 element\\\"]}\",
! 69: \"quotes\": \"" \\u0022 %22 0x22 034 "\",
! 70: \"\\/\\\\\\\"\\uCAFE\\uBABE\\uAB98\\uFCDE\\ubcda\\uef4A\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?\"
! 71: : \"A key can be any string\"
! 72: },
! 73: 0.5 ,98.6
! 74: ,
! 75: 99.44
! 76: ,
! 77:
! 78: 1066
! 79:
! 80:
! 81: ,\"rosebud\"]
! 82: ";
! 83:
! 84: echo 'Testing: ' . $test . "\n";
! 85: echo "DECODE: AS OBJECT\n";
! 86: $obj = json_decode($test);
! 87: var_dump($obj);
! 88: echo "DECODE: AS ARRAY\n";
! 89: $arr = json_decode($test, true);
! 90: var_dump($arr);
! 91:
! 92: echo "ENCODE: FROM OBJECT\n";
! 93: $obj_enc = json_encode($obj);
! 94: echo $obj_enc . "\n";
! 95: echo "ENCODE: FROM ARRAY\n";
! 96: $arr_enc = json_encode($arr);
! 97: echo $arr_enc . "\n";
! 98:
! 99: echo "DECODE AGAIN: AS OBJECT\n";
! 100: $obj = json_decode($obj_enc);
! 101: var_dump($obj);
! 102: echo "DECODE AGAIN: AS ARRAY\n";
! 103: $arr = json_decode($arr_enc, true);
! 104: var_dump($arr);
! 105:
! 106: ?>
! 107: --EXPECTF--
! 108: Testing:
! 109: [
! 110: "JSON Test Pattern pass1",
! 111: {"object with 1 member":["array with 1 element"]},
! 112: {},
! 113: [],
! 114: -42,
! 115: true,
! 116: false,
! 117: null,
! 118: {
! 119: "integer": 1234567890,
! 120: "real": -9876.543210,
! 121: "e": 0.123456789e-12,
! 122: "E": 1.234567890E+34,
! 123: "": 23456789012E666,
! 124: "E no .": 4E12,
! 125: "zero": 0,
! 126: "one": 1,
! 127: "space": " ",
! 128: "quote": "\"",
! 129: "backslash": "\\",
! 130: "controls": "\b\f\n\r\t",
! 131: "slash": "/ & \/",
! 132: "alpha": "abcdefghijklmnopqrstuvwyz",
! 133: "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
! 134: "digit": "0123456789",
! 135: "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
! 136: "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
! 137: "unicode": "\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8",
! 138: "プレスキット": "プレスキット",
! 139: "empty_string": "",
! 140: "true": true,
! 141: "false": false,
! 142: "null": null,
! 143: "array":[ ],
! 144: "object":{ },
! 145: "123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},
! 146: "address": "50 St. James Street",
! 147: "url": "http://www.JSON.org/",
! 148: "comment": "// /* <!-- --",
! 149: "# -- --> */": " ",
! 150: " s p a c e d " :[1,2 , 3
! 151:
! 152: ,
! 153:
! 154: 4 , 5 , 6 ,7 ],
! 155: "compact": [1,2,3,4,5,6,7],
! 156: "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
! 157: "quotes": "" \u0022 %22 0x22 034 "",
! 158: "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
! 159: : "A key can be any string"
! 160: },
! 161: 0.5 ,98.6
! 162: ,
! 163: 99.44
! 164: ,
! 165:
! 166: 1066
! 167:
! 168:
! 169: ,"rosebud"]
! 170:
! 171: DECODE: AS OBJECT
! 172: array(14) {
! 173: [0]=>
! 174: string(23) "JSON Test Pattern pass1"
! 175: [1]=>
! 176: object(stdClass)#%d (1) {
! 177: ["object with 1 member"]=>
! 178: array(1) {
! 179: [0]=>
! 180: string(20) "array with 1 element"
! 181: }
! 182: }
! 183: [2]=>
! 184: object(stdClass)#%d (0) {
! 185: }
! 186: [3]=>
! 187: array(0) {
! 188: }
! 189: [4]=>
! 190: int(-42)
! 191: [5]=>
! 192: bool(true)
! 193: [6]=>
! 194: bool(false)
! 195: [7]=>
! 196: NULL
! 197: [8]=>
! 198: object(stdClass)#%d (36) {
! 199: ["integer"]=>
! 200: int(1234567890)
! 201: ["real"]=>
! 202: float(-9876.54321)
! 203: ["e"]=>
! 204: float(1.23456789E-13)
! 205: ["E"]=>
! 206: float(1.23456789E+34)
! 207: ["_empty_"]=>
! 208: float(INF)
! 209: ["E no ."]=>
! 210: float(4000000000000)
! 211: ["zero"]=>
! 212: int(0)
! 213: ["one"]=>
! 214: int(1)
! 215: ["space"]=>
! 216: string(1) " "
! 217: ["quote"]=>
! 218: string(1) """
! 219: ["backslash"]=>
! 220: string(1) "\"
! 221: ["controls"]=>
! 222: string(5) "
! 223:
"
! 224: ["slash"]=>
! 225: string(5) "/ & /"
! 226: ["alpha"]=>
! 227: string(25) "abcdefghijklmnopqrstuvwyz"
! 228: ["ALPHA"]=>
! 229: string(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
! 230: ["digit"]=>
! 231: string(10) "0123456789"
! 232: ["special"]=>
! 233: string(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
! 234: ["hex"]=>
! 235: string(17) "ģ䕧覫췯ꯍ"
! 236: ["unicode"]=>
! 237: string(18) "プレスキット"
! 238: ["プレスキット"]=>
! 239: string(18) "プレスキット"
! 240: ["empty_string"]=>
! 241: string(0) ""
! 242: ["true"]=>
! 243: bool(true)
! 244: ["false"]=>
! 245: bool(false)
! 246: ["null"]=>
! 247: NULL
! 248: ["array"]=>
! 249: array(0) {
! 250: }
! 251: ["object"]=>
! 252: object(stdClass)#%d (0) {
! 253: }
! 254: ["123"]=>
! 255: object(stdClass)#%d (1) {
! 256: ["456"]=>
! 257: object(stdClass)#%d (1) {
! 258: ["abc"]=>
! 259: object(stdClass)#%d (3) {
! 260: ["789"]=>
! 261: string(3) "def"
! 262: ["012"]=>
! 263: array(4) {
! 264: [0]=>
! 265: int(1)
! 266: [1]=>
! 267: int(2)
! 268: [2]=>
! 269: string(1) "5"
! 270: [3]=>
! 271: int(500)
! 272: }
! 273: ["ghi"]=>
! 274: array(5) {
! 275: [0]=>
! 276: int(1)
! 277: [1]=>
! 278: int(2)
! 279: [2]=>
! 280: string(4) "five"
! 281: [3]=>
! 282: int(50)
! 283: [4]=>
! 284: string(5) "sixty"
! 285: }
! 286: }
! 287: }
! 288: }
! 289: ["address"]=>
! 290: string(19) "50 St. James Street"
! 291: ["url"]=>
! 292: string(20) "http://www.JSON.org/"
! 293: ["comment"]=>
! 294: string(13) "// /* <!-- --"
! 295: ["# -- --> */"]=>
! 296: string(1) " "
! 297: [" s p a c e d "]=>
! 298: array(7) {
! 299: [0]=>
! 300: int(1)
! 301: [1]=>
! 302: int(2)
! 303: [2]=>
! 304: int(3)
! 305: [3]=>
! 306: int(4)
! 307: [4]=>
! 308: int(5)
! 309: [5]=>
! 310: int(6)
! 311: [6]=>
! 312: int(7)
! 313: }
! 314: ["compact"]=>
! 315: array(7) {
! 316: [0]=>
! 317: int(1)
! 318: [1]=>
! 319: int(2)
! 320: [2]=>
! 321: int(3)
! 322: [3]=>
! 323: int(4)
! 324: [4]=>
! 325: int(5)
! 326: [5]=>
! 327: int(6)
! 328: [6]=>
! 329: int(7)
! 330: }
! 331: ["jsontext"]=>
! 332: string(49) "{"object with 1 member":["array with 1 element"]}"
! 333: ["quotes"]=>
! 334: string(27) "" " %22 0x22 034 ""
! 335: ["/\"쫾몾ꮘﳞ볚
! 336:
`1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
! 337: string(23) "A key can be any string"
! 338: }
! 339: [9]=>
! 340: float(0.5)
! 341: [10]=>
! 342: float(98.6)
! 343: [11]=>
! 344: float(99.44)
! 345: [12]=>
! 346: int(1066)
! 347: [13]=>
! 348: string(7) "rosebud"
! 349: }
! 350: DECODE: AS ARRAY
! 351: array(14) {
! 352: [0]=>
! 353: string(23) "JSON Test Pattern pass1"
! 354: [1]=>
! 355: array(1) {
! 356: ["object with 1 member"]=>
! 357: array(1) {
! 358: [0]=>
! 359: string(20) "array with 1 element"
! 360: }
! 361: }
! 362: [2]=>
! 363: array(0) {
! 364: }
! 365: [3]=>
! 366: array(0) {
! 367: }
! 368: [4]=>
! 369: int(-42)
! 370: [5]=>
! 371: bool(true)
! 372: [6]=>
! 373: bool(false)
! 374: [7]=>
! 375: NULL
! 376: [8]=>
! 377: array(36) {
! 378: ["integer"]=>
! 379: int(1234567890)
! 380: ["real"]=>
! 381: float(-9876.54321)
! 382: ["e"]=>
! 383: float(1.23456789E-13)
! 384: ["E"]=>
! 385: float(1.23456789E+34)
! 386: [""]=>
! 387: float(INF)
! 388: ["E no ."]=>
! 389: float(4000000000000)
! 390: ["zero"]=>
! 391: int(0)
! 392: ["one"]=>
! 393: int(1)
! 394: ["space"]=>
! 395: string(1) " "
! 396: ["quote"]=>
! 397: string(1) """
! 398: ["backslash"]=>
! 399: string(1) "\"
! 400: ["controls"]=>
! 401: string(5) "
! 402:
"
! 403: ["slash"]=>
! 404: string(5) "/ & /"
! 405: ["alpha"]=>
! 406: string(25) "abcdefghijklmnopqrstuvwyz"
! 407: ["ALPHA"]=>
! 408: string(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
! 409: ["digit"]=>
! 410: string(10) "0123456789"
! 411: ["special"]=>
! 412: string(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
! 413: ["hex"]=>
! 414: string(17) "ģ䕧覫췯ꯍ"
! 415: ["unicode"]=>
! 416: string(18) "プレスキット"
! 417: ["プレスキット"]=>
! 418: string(18) "プレスキット"
! 419: ["empty_string"]=>
! 420: string(0) ""
! 421: ["true"]=>
! 422: bool(true)
! 423: ["false"]=>
! 424: bool(false)
! 425: ["null"]=>
! 426: NULL
! 427: ["array"]=>
! 428: array(0) {
! 429: }
! 430: ["object"]=>
! 431: array(0) {
! 432: }
! 433: [123]=>
! 434: array(1) {
! 435: [456]=>
! 436: array(1) {
! 437: ["abc"]=>
! 438: array(3) {
! 439: [789]=>
! 440: string(3) "def"
! 441: ["012"]=>
! 442: array(4) {
! 443: [0]=>
! 444: int(1)
! 445: [1]=>
! 446: int(2)
! 447: [2]=>
! 448: string(1) "5"
! 449: [3]=>
! 450: int(500)
! 451: }
! 452: ["ghi"]=>
! 453: array(5) {
! 454: [0]=>
! 455: int(1)
! 456: [1]=>
! 457: int(2)
! 458: [2]=>
! 459: string(4) "five"
! 460: [3]=>
! 461: int(50)
! 462: [4]=>
! 463: string(5) "sixty"
! 464: }
! 465: }
! 466: }
! 467: }
! 468: ["address"]=>
! 469: string(19) "50 St. James Street"
! 470: ["url"]=>
! 471: string(20) "http://www.JSON.org/"
! 472: ["comment"]=>
! 473: string(13) "// /* <!-- --"
! 474: ["# -- --> */"]=>
! 475: string(1) " "
! 476: [" s p a c e d "]=>
! 477: array(7) {
! 478: [0]=>
! 479: int(1)
! 480: [1]=>
! 481: int(2)
! 482: [2]=>
! 483: int(3)
! 484: [3]=>
! 485: int(4)
! 486: [4]=>
! 487: int(5)
! 488: [5]=>
! 489: int(6)
! 490: [6]=>
! 491: int(7)
! 492: }
! 493: ["compact"]=>
! 494: array(7) {
! 495: [0]=>
! 496: int(1)
! 497: [1]=>
! 498: int(2)
! 499: [2]=>
! 500: int(3)
! 501: [3]=>
! 502: int(4)
! 503: [4]=>
! 504: int(5)
! 505: [5]=>
! 506: int(6)
! 507: [6]=>
! 508: int(7)
! 509: }
! 510: ["jsontext"]=>
! 511: string(49) "{"object with 1 member":["array with 1 element"]}"
! 512: ["quotes"]=>
! 513: string(27) "" " %22 0x22 034 ""
! 514: ["/\"쫾몾ꮘﳞ볚
! 515:
`1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
! 516: string(23) "A key can be any string"
! 517: }
! 518: [9]=>
! 519: float(0.5)
! 520: [10]=>
! 521: float(98.6)
! 522: [11]=>
! 523: float(99.44)
! 524: [12]=>
! 525: int(1066)
! 526: [13]=>
! 527: string(7) "rosebud"
! 528: }
! 529: ENCODE: FROM OBJECT
! 530: ["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},{},[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"_empty_":0,"E no .":4000000000000,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array":[],"object":{},"123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"" \" %22 0x22 034 "","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
! 531: ENCODE: FROM ARRAY
! 532: ["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},[],[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"":0,"E no .":4000000000000,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array":[],"object":[],"123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"" \" %22 0x22 034 "","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
! 533: DECODE AGAIN: AS OBJECT
! 534: array(14) {
! 535: [0]=>
! 536: string(23) "JSON Test Pattern pass1"
! 537: [1]=>
! 538: object(stdClass)#%d (1) {
! 539: ["object with 1 member"]=>
! 540: array(1) {
! 541: [0]=>
! 542: string(20) "array with 1 element"
! 543: }
! 544: }
! 545: [2]=>
! 546: object(stdClass)#%d (0) {
! 547: }
! 548: [3]=>
! 549: array(0) {
! 550: }
! 551: [4]=>
! 552: int(-42)
! 553: [5]=>
! 554: bool(true)
! 555: [6]=>
! 556: bool(false)
! 557: [7]=>
! 558: NULL
! 559: [8]=>
! 560: object(stdClass)#%d (36) {
! 561: ["integer"]=>
! 562: int(1234567890)
! 563: ["real"]=>
! 564: float(-9876.54321)
! 565: ["e"]=>
! 566: float(1.23456789E-13)
! 567: ["E"]=>
! 568: float(1.23456789E+34)
! 569: ["_empty_"]=>
! 570: int(0)
! 571: ["E no ."]=>
! 572: %s(4000000000000)
! 573: ["zero"]=>
! 574: int(0)
! 575: ["one"]=>
! 576: int(1)
! 577: ["space"]=>
! 578: string(1) " "
! 579: ["quote"]=>
! 580: string(1) """
! 581: ["backslash"]=>
! 582: string(1) "\"
! 583: ["controls"]=>
! 584: string(5) "
! 585:
"
! 586: ["slash"]=>
! 587: string(5) "/ & /"
! 588: ["alpha"]=>
! 589: string(25) "abcdefghijklmnopqrstuvwyz"
! 590: ["ALPHA"]=>
! 591: string(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
! 592: ["digit"]=>
! 593: string(10) "0123456789"
! 594: ["special"]=>
! 595: string(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
! 596: ["hex"]=>
! 597: string(17) "ģ䕧覫췯ꯍ"
! 598: ["unicode"]=>
! 599: string(18) "プレスキット"
! 600: ["プレスキット"]=>
! 601: string(18) "プレスキット"
! 602: ["empty_string"]=>
! 603: string(0) ""
! 604: ["true"]=>
! 605: bool(true)
! 606: ["false"]=>
! 607: bool(false)
! 608: ["null"]=>
! 609: NULL
! 610: ["array"]=>
! 611: array(0) {
! 612: }
! 613: ["object"]=>
! 614: object(stdClass)#%d (0) {
! 615: }
! 616: ["123"]=>
! 617: object(stdClass)#%d (1) {
! 618: ["456"]=>
! 619: object(stdClass)#%d (1) {
! 620: ["abc"]=>
! 621: object(stdClass)#%d (3) {
! 622: ["789"]=>
! 623: string(3) "def"
! 624: ["012"]=>
! 625: array(4) {
! 626: [0]=>
! 627: int(1)
! 628: [1]=>
! 629: int(2)
! 630: [2]=>
! 631: string(1) "5"
! 632: [3]=>
! 633: int(500)
! 634: }
! 635: ["ghi"]=>
! 636: array(5) {
! 637: [0]=>
! 638: int(1)
! 639: [1]=>
! 640: int(2)
! 641: [2]=>
! 642: string(4) "five"
! 643: [3]=>
! 644: int(50)
! 645: [4]=>
! 646: string(5) "sixty"
! 647: }
! 648: }
! 649: }
! 650: }
! 651: ["address"]=>
! 652: string(19) "50 St. James Street"
! 653: ["url"]=>
! 654: string(20) "http://www.JSON.org/"
! 655: ["comment"]=>
! 656: string(13) "// /* <!-- --"
! 657: ["# -- --> */"]=>
! 658: string(1) " "
! 659: [" s p a c e d "]=>
! 660: array(7) {
! 661: [0]=>
! 662: int(1)
! 663: [1]=>
! 664: int(2)
! 665: [2]=>
! 666: int(3)
! 667: [3]=>
! 668: int(4)
! 669: [4]=>
! 670: int(5)
! 671: [5]=>
! 672: int(6)
! 673: [6]=>
! 674: int(7)
! 675: }
! 676: ["compact"]=>
! 677: array(7) {
! 678: [0]=>
! 679: int(1)
! 680: [1]=>
! 681: int(2)
! 682: [2]=>
! 683: int(3)
! 684: [3]=>
! 685: int(4)
! 686: [4]=>
! 687: int(5)
! 688: [5]=>
! 689: int(6)
! 690: [6]=>
! 691: int(7)
! 692: }
! 693: ["jsontext"]=>
! 694: string(49) "{"object with 1 member":["array with 1 element"]}"
! 695: ["quotes"]=>
! 696: string(27) "" " %22 0x22 034 ""
! 697: ["/\"쫾몾ꮘﳞ볚
! 698:
`1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
! 699: string(23) "A key can be any string"
! 700: }
! 701: [9]=>
! 702: float(0.5)
! 703: [10]=>
! 704: float(98.6)
! 705: [11]=>
! 706: float(99.44)
! 707: [12]=>
! 708: int(1066)
! 709: [13]=>
! 710: string(7) "rosebud"
! 711: }
! 712: DECODE AGAIN: AS ARRAY
! 713: array(14) {
! 714: [0]=>
! 715: string(23) "JSON Test Pattern pass1"
! 716: [1]=>
! 717: array(1) {
! 718: ["object with 1 member"]=>
! 719: array(1) {
! 720: [0]=>
! 721: string(20) "array with 1 element"
! 722: }
! 723: }
! 724: [2]=>
! 725: array(0) {
! 726: }
! 727: [3]=>
! 728: array(0) {
! 729: }
! 730: [4]=>
! 731: int(-42)
! 732: [5]=>
! 733: bool(true)
! 734: [6]=>
! 735: bool(false)
! 736: [7]=>
! 737: NULL
! 738: [8]=>
! 739: array(36) {
! 740: ["integer"]=>
! 741: int(1234567890)
! 742: ["real"]=>
! 743: float(-9876.54321)
! 744: ["e"]=>
! 745: float(1.23456789E-13)
! 746: ["E"]=>
! 747: float(1.23456789E+34)
! 748: [""]=>
! 749: int(0)
! 750: ["E no ."]=>
! 751: %s(4000000000000)
! 752: ["zero"]=>
! 753: int(0)
! 754: ["one"]=>
! 755: int(1)
! 756: ["space"]=>
! 757: string(1) " "
! 758: ["quote"]=>
! 759: string(1) """
! 760: ["backslash"]=>
! 761: string(1) "\"
! 762: ["controls"]=>
! 763: string(5) "
! 764:
"
! 765: ["slash"]=>
! 766: string(5) "/ & /"
! 767: ["alpha"]=>
! 768: string(25) "abcdefghijklmnopqrstuvwyz"
! 769: ["ALPHA"]=>
! 770: string(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
! 771: ["digit"]=>
! 772: string(10) "0123456789"
! 773: ["special"]=>
! 774: string(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
! 775: ["hex"]=>
! 776: string(17) "ģ䕧覫췯ꯍ"
! 777: ["unicode"]=>
! 778: string(18) "プレスキット"
! 779: ["プレスキット"]=>
! 780: string(18) "プレスキット"
! 781: ["empty_string"]=>
! 782: string(0) ""
! 783: ["true"]=>
! 784: bool(true)
! 785: ["false"]=>
! 786: bool(false)
! 787: ["null"]=>
! 788: NULL
! 789: ["array"]=>
! 790: array(0) {
! 791: }
! 792: ["object"]=>
! 793: array(0) {
! 794: }
! 795: [123]=>
! 796: array(1) {
! 797: [456]=>
! 798: array(1) {
! 799: ["abc"]=>
! 800: array(3) {
! 801: [789]=>
! 802: string(3) "def"
! 803: ["012"]=>
! 804: array(4) {
! 805: [0]=>
! 806: int(1)
! 807: [1]=>
! 808: int(2)
! 809: [2]=>
! 810: string(1) "5"
! 811: [3]=>
! 812: int(500)
! 813: }
! 814: ["ghi"]=>
! 815: array(5) {
! 816: [0]=>
! 817: int(1)
! 818: [1]=>
! 819: int(2)
! 820: [2]=>
! 821: string(4) "five"
! 822: [3]=>
! 823: int(50)
! 824: [4]=>
! 825: string(5) "sixty"
! 826: }
! 827: }
! 828: }
! 829: }
! 830: ["address"]=>
! 831: string(19) "50 St. James Street"
! 832: ["url"]=>
! 833: string(20) "http://www.JSON.org/"
! 834: ["comment"]=>
! 835: string(13) "// /* <!-- --"
! 836: ["# -- --> */"]=>
! 837: string(1) " "
! 838: [" s p a c e d "]=>
! 839: array(7) {
! 840: [0]=>
! 841: int(1)
! 842: [1]=>
! 843: int(2)
! 844: [2]=>
! 845: int(3)
! 846: [3]=>
! 847: int(4)
! 848: [4]=>
! 849: int(5)
! 850: [5]=>
! 851: int(6)
! 852: [6]=>
! 853: int(7)
! 854: }
! 855: ["compact"]=>
! 856: array(7) {
! 857: [0]=>
! 858: int(1)
! 859: [1]=>
! 860: int(2)
! 861: [2]=>
! 862: int(3)
! 863: [3]=>
! 864: int(4)
! 865: [4]=>
! 866: int(5)
! 867: [5]=>
! 868: int(6)
! 869: [6]=>
! 870: int(7)
! 871: }
! 872: ["jsontext"]=>
! 873: string(49) "{"object with 1 member":["array with 1 element"]}"
! 874: ["quotes"]=>
! 875: string(27) "" " %22 0x22 034 ""
! 876: ["/\"쫾몾ꮘﳞ볚
! 877:
`1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
! 878: string(23) "A key can be any string"
! 879: }
! 880: [9]=>
! 881: float(0.5)
! 882: [10]=>
! 883: float(98.6)
! 884: [11]=>
! 885: float(99.44)
! 886: [12]=>
! 887: int(1066)
! 888: [13]=>
! 889: string(7) "rosebud"
! 890: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>