Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3655

Convert string-array and add double quotes to values [closed]

$
0
0

Trying to build a WebHook in PHP and send it some data from Zapier, so I am testing in Postman.

Apparently, Zapier is sending a "array-string" type object that looks like this:

"[{'id': 1234, 'campaign_name': 'SOME CAMPAIGN NAME', 'campaign_type': 'Single Content', 'action_type': 'Email', 'topic': 'NONE', 'country_target': 'US', 'created_at': 1702230370167, 'modified_by': 'MYEMAIL@YAHOO.COM', 'isactive': True, 'ispublish': True, 'user_id': 111, 'modified_at': 1736543477011}]"

Postman doesn't like the single quotes.

In my WebHook, I am decoding the payload like this:

$payload = json_decode(file_get_contents("php://input"), true);

Then I print it like this:

print_r($payload);

I thought the decode would work, but it still has the single quotes. Printing the payload looks like this:

[{'id': 1234, 'campaign_name': 'SOME CAMPAIGN NAME', 'campaign_type': 'SingleContent', 'action_type': 'Email', 'topic': 'NONE', 'country_target': 'US', 'created_at': 1702230370167, 'modified_by': 'MYEMAIL@YAHOO.COM', 'isactive': True, 'ispublish': True, 'user_id': 111,'modified_at': 1736543477011}]

Still has the single quotes.

How can I add double quotes to the values?


Viewing all articles
Browse latest Browse all 3655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>