[Dancer-users] formatting curl output

Brian E. Lozier brian at massassi.com
Sun Feb 27 16:55:47 CET 2011


I think the issue here is that you're getting the JSON in "pretty"
mode (it probably is tabbed/indented but isn't showing over email).
There is a line in Dancer::Serializer::JSON which enables "pretty"
mode like this:

    if (setting('environment') eq 'development' and not defined
$options->{pretty}) {
        $options->{pretty} = 1;
    }

If you disable pretty mode you'll get it all on one line.  I'm not
sure how to set the $options->{pretty} in the dancer serializer
module.


On Sun, Feb 27, 2011 at 2:22 AM, sawyer x <xsawyerx at gmail.com> wrote:
> You might want to look at "Data::Dump", its function tries to do that
> automatically.
> But that will only be useful for debugging purposes, to look pretty in your
> terminal.
>
> Also check David's Dancer::Plugin::Debug
>
> On Sun, Feb 27, 2011 at 5:31 AM, Puneet Kishor <punk.kish at gmail.com> wrote:
>>
>> punkish at Lucknow ~$curl
>> 'http://dm.local/dm.json?var=prcp&from=1980-1-1&to=1980-2-2'
>> {
>>  "prcp" : [
>> 0,
>> 1,
>> 1,
>> 0,
>> ..
>> ]
>> }
>>
>> Is there a way to get that curl output to be more compact, like so
>>
>> {"prcp": [0,1,1,0, .. ]}
>>
>>
>> On the server side all I am doing is
>>
>> return {'prcp' => \@vals};
>>
>> --
>> Puneet Kishor
>>
>>
>>
>> _______________________________________________
>> Dancer-users mailing list
>> Dancer-users at perldancer.org
>> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>
>
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>
>


More information about the Dancer-users mailing list