kim larsen
kim larsen

Reputation: 5451

Javascript, PHP json will not parse?

I am sending this to PHP:

  {'command' : 'move', 'data' : { 'seat_id' : '"+seat+"'}}

But cannot parse it though PHP. The correct data i got from PHP is:

 {'command' : 'move', 'data' : { 'seat_id' : '44'}}

I have tried following:

 <?php
 $in = $Server->output(); //this is the json text
 $o = json_decode($in); //has also tried put "TRUE" in the function.
 print_r($o); ?>

It just output

 {'command' : 'move', 'data' : { 'seat_id' : '44'}}

Upvotes: 1

Views: 76

Answers (1)

Amber
Amber

Reputation: 527213

Proper JSON uses double quotes, not single quotes.

Upvotes: 3

Related Questions