Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Interpolating variables in JSON string

by roboticus (Canon)
on Jan 29, 2013 at 11:49 UTC ( #1015867=note: print w/ replies, xml ) Need Help??


in reply to Interpolating variables in JSON string

j0se:

I agree with the previous posters. However, it looks like you're just forgetting to put quotes around $USERNAME and $API_KEY. JSON is going to want quotes around string values, and you're just dropping them in without the quotes. You probably need:

my $json = quotemeta( {"auth":{"RAX-KSKEY:apiKeyCredentials":{"usernam +e":"$USERNAME", "apiKey":"$API_KEY"}}} );

So while this may get you going for now, just remember that it'll come back to bite you if you're not careful. Hence, the aforementioned suggestions.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re: Interpolating variables in JSON string
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015867]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2014-07-26 03:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls