I'm creating php rest service which will be consumed by c# desktop application using HttpWebRequest class.
I would like to pass json to service with post method, and create associative array in php which I would use to process user request.
I have tried to send json as a string in different formats (ex. "{"x":"y"}" or "{'x':'y'}"), also to use JsonConvert.SerializeObject form Newtonsoft.Json to serialize object in application and tried to convert that to array using json_encode method. But it always keeps it as a string. I have even tried to change string from post in php to match format required by json_encode (ex. '{"x":"y"}') but can't do it.
So my question basically is how to format json in c# so I can use it in php script?
Aucun commentaire:
Enregistrer un commentaire