title: JSON PHP Array to Javascript
body: <p>Is it possible to JSON this php array via json_encode?
  Because this php array is called <code>$data</code> and when i do.. </p>
  
  <pre><code>var myJson = &lt;?php echo json_encode($data) ?&gt;;
  console.log(myJson);
  </code></pre>
  
  <p>in javascript, it give me errors. I was wondering if there is a limitation on what sort of php arrays JSON can/cannot do. </p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Tanner, C. kickoff 60 yards to the DU5, Butler, L return 14 yards to the DU19 (Johnson, I.).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT35
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 10
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; K
                          )
  
                      [drive] =&gt; 1
                  )
  
          )
  
      [1] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Renfree, S pass complete to Vernon, C for 6 yards to the DU25 (Thomas, Je.).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU19
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 10
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; P
                          )
  
                      [drive] =&gt; 2
                  )
  
              [1] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Renfree, S pass incomplete to Scott, D.
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU25
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 4
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; P
                          )
  
                      [drive] =&gt; 2
                  )
  
              [2] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Renfree, S pass complete to Scott, D for 6 yards to the DU31, 1ST DOWN DU (Thomas, Je.).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU25
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 4
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; P
                          )
  
                      [drive] =&gt; 2
                  )
  
              [3] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Renfree, S pass complete to Scott, D for no gain to the DU31 (Sweeting, R.).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU31
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 10
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; P
                          )
  
                      [drive] =&gt; 2
                  )
  
              [4] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Renfree, S pass incomplete to Vernon, C.
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU31
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 10
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; P
                          )
  
                      [drive] =&gt; 2
                  )
  
              [5] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Renfree, S sacked for loss of 4 yards to the DU27 (Gotsis, A.).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU31
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 10
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; P
                          )
  
                      [drive] =&gt; 2
                  )
  
              [6] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Monday, W punt 53 yards to the GT20, Golden, J. return 8 yards to the GT28 (Reeves, D).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU27
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 14
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; U
                          )
  
                      [drive] =&gt; 2
                  )
  
          )
  
      [2] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Smith, O. rush for 8 yards to the GT36 (Brown, Ky).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT28
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 10
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; R
                          )
  
                      [drive] =&gt; 3
                  )
  
              [1] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Sims, D. rush for 6 yards to the GT42, 1ST DOWN GT (Sink, N).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT36
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 2
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; R
                          )
  
                      [drive] =&gt; 3
                  )
  
              [2] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Washington, T. pass incomplete to Smith, O..
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT42
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 10
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; P
                          )
  
                      [drive] =&gt; 3
                  )
  
              [3] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Washington, T. rush for 2 yards to the GT44 (Anunike, K).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT42
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 10
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; R
                          )
  
                      [drive] =&gt; 3
                  )
  
              [4] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Greene, J. rush for 6 yards to the 50 yardline (Canty, W).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT44
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 8
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; R
                          )
  
                      [drive] =&gt; 3
                  )
  
              [5] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Smith, O. rush for 16 yards to the DU34, 1ST DOWN GT (Canty, W;France, C).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT50
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 2
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; R
                          )
  
                      [drive] =&gt; 3
                  )
  
              [6] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Smith, O. rush for 5 yards to the DU29 (France, C).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU34
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 10
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; R
                          )
  
                      [drive] =&gt; 3
                  )
  
              [7] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Laskey, Z. rush for 3 yards to the DU26 (France, C).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU29
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 5
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; R
                          )
  
                      [drive] =&gt; 3
                  )
  
              [8] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Washington, T. rush for 3 yards to the DU23, 1ST DOWN GT (France, C).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU26
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 2
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; R
                          )
  
                      [drive] =&gt; 3
                  )
  
              [9] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Washington, T. pass complete to Smith, O. for 21 yards to the DU2, 1ST DOWN GT (Butler, L).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU23
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 10
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; P
                          )
  
                      [drive] =&gt; 3
                  )
  
              [10] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Washington, T. rush for 1 yard to the DU1 (Brown, Ky;Foxx, J).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU02
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 0
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; R
                          )
  
                      [drive] =&gt; 3
                  )
  
              [11] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Washington, T. rush for no gain to the DU1 (Cockrell, R).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU01
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 0
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; R
                          )
  
                      [drive] =&gt; 3
                  )
  
              [12] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Washington, T. rush for 1 yard to the DU0, TOUCHDOWN, clock 06:51.
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU01
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 0
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; R
                          )
  
                      [drive] =&gt; 3
                  )
  
              [13] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Tanner, C. kick attempt good.
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; DU03
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 0
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; X
                          )
  
                      [drive] =&gt; 3
                  )
  
              [14] =&gt; Array
                  (
                      [text] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; Tanner, C. kickoff 54 yards to the DU11, Butler, L return 23 yards to the DU34 (Harrell, A.).
                          )
  
                      [spot] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT35
                          )
  
                      [ball] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; GT
                          )
  
                      [togo] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; 0
                          )
  
                      [type] =&gt; SimpleXMLElement Object
                          (
                              [0] =&gt; K
                          )
  
                      [drive] =&gt; 3
                  )
  
          )
  )
  </code></pre>