Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Json epoch datetime with perl

by hdb (Prior)
on May 28, 2014 at 09:26 UTC ( #1087626=note: print w/replies, xml ) Need Help??

in reply to Json epoch datetime with perl

The immediate question I have is what you would need the backslash for. It sounds a bit like an XY Problem to me. You said you really wanted a date field but that still does not tell me what the backslash is good for.

Replies are listed 'Best First'.
Re^2: Json epoch datetime with perl
by gurpreetsingh13 (Scribe) on May 28, 2014 at 09:35 UTC
    I want to pass this JSON object to a Web Service and the example structure given for the object is showing the similar kind of backslashes. Here is the exact copy paste of that field. Date is in epoch milliseconds.
      #!perl; use strict; use JSON; my $json = new JSON->escape_slash(); my $roundParams = { 'AllowParticipantsToSeeEachOther' => JSON::PP::true, 'DurationInMinutes' => 10, 'MaxGamePegValue' => 5, 'MaxNumberOfCrackAttemptsPerCode' => 18, 'MaxNumberOfCrackAttemptsPerTeam' => 0, 'NumberOfDefaultHostParticipants' => 1, 'NumberOfPegsInRound' => 4, 'RoundStartTime' => "/Date(".time.")/", 'TimeBetweenRoundATimeBetweenRoundAttemptsInSeconds' => 10 }; print $json->encode($roundParams);
        Thanks a lot man. This worked out perfectly. Surprised, I still couldn't find such a thing over google or in docs.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1087626]
[Mr. Muskrat]: (considered) Re^3: Please help with Regexp::Common needs to be reparented to Re^2: Please help with Regexp::Common
[Mr. Muskrat]: Is it just me or does that timeout issue seems to be happening more often lately?
[Corion]: Mr. Muskrat: I'm not sure if it really happens more often, but I don't exactly know either
[LanX]: yep
[LanX]: more often for some weeks now
[Corion]: I think I'll have to manually (as god) intervene with that node, as the simple reparenting didn't seem to fix the parent/child relationship of the nodes
[Corion]: I think I have an idea but I'll have to open a ticket with on that - hopefully I get to that on the weekend
LanX imagines a burning thorn bush
[Mr. Muskrat]: Thank you!
[Mr. Muskrat]: Oh that is odd. I got the message that it was reparented but yeah, it didn't actually do it. lol

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2017-01-19 16:24 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (170 votes). Check out past polls.