php - special char in JSON -


I should send hi " to a Yahoo server, so in PHP, to be ", but it will get a bad JSON argument. How do i do it

$ message = "hi \" "; in the JSON code without any errors; $ Postdata = '{"Message": "'. $ Message. '"' ';

Hand-crafting JSON instead of use:

  $ Postdata = json_encode (array ("message" => message $););   

If you have to manually add your JSON, make sure to add a backslash before the quotation marks:

  $ message = "hi \\\" "; // Or, more clearly ... $ message = 'Hi \\' ';    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -