I am using json_encode
in PHP to encode an URL
$json_string = array (\'myUrl\'=> \'http://example.com\');
echo json_encode ($json_string);
>
I see another problem here. The string result {"myUrl":"http://example.com"}
should not have the member name myUrl quoted. In JavaScript and JSON, I think all object literal member ids are unquoted strings. So, I would expect the result to be {myUrl:"http://example.com"}
.
This seems too big a bug in PHP, so I must be wrong.
Edit, 2/11/11: Yes, I'm wrong. JSON syntax requires even the field names to be in double quotation marks.