pass001.1_64bit.phpt 19 KB

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