On Mon, Sep 15, 2014 at 10:07 AM, sri <[email protected]> wrote:

> So why wouldn't Mojo::JSON be able to parse the non-pretty printed JSON
>> that is the response of CouchDB?
>>
>
> Maybe try parsing it with Mojo::JSON and check the error message?
>

Great idea!  My apologies if this should have been gist'd...  It's fairly
small.  I did gist the JSON-parsing Perl script
<https://gist.github.com/stefan-kt/8e408c5398f9424a93f7>.

$ mojo get 
'http://localhost:5984/rtc/_design/lookup/_view/user?key=["a21d7f30-f5f8-466e-aff9-25196b576dfe","ab7093f9bbc349a12c52b449c0002354";]'
| perl testmojo.pl
$VAR1 = {
*          'total_rows' => 2,*
          'rows' => [
                    {
                      'id' => 'ab7093f9bbc349a12c52b449c0001feb',
                      'key' => [
                               'a21d7f30-f5f8-466e-aff9-25196b576dfe',
                               'ab7093f9bbc349a12c52b449c0002354'
                             ],
                      'value' => {
                                 'type' => 'user',
                                 'like' => 1,
                                 '_rev' =>
'4-7b1109dc12883bee47fb70cc96e2bc10',
                                 'webview' => [
                                              6
                                            ],
                                 'device' =>
'a21d7f30-f5f8-466e-aff9-25196b576dfe',
                                 'details' =>
'ab7093f9bbc349a12c52b449c0002354',
                                 '_id' => 'ab7093f9bbc349a12c52b449c0001feb'
                               }
                    }
                  ],
          'offset' => 0
        };

$ mojo get 
'http://localhost:5984/rtc/_design/lookup/_view/user?key=["a21d7f30-f5f8-466e-aff9-25196b576dfe","ab7093f9bbc349a12c52b449c0002354";]'
*/total_rows*
*[ NO RESPONSE ]*

$ mojo get https://api.metacpan.org/v0/author/SRI | perl testmojo.pl
$VAR1 = {
          'country' => 'DE',
             :
*          'name' => 'Sebastian Riedel',*
             :
          'updated' => '2013-11-22T00:01:14',
        };

$ mojo get https://api.metacpan.org/v0/author/SRI */name*
Sebastian Riedel

So as you can see, I'm working it in the same manner as the documentation,
and the JSON data I'm struggling with is Mojo::JSON parseable.  But I'm not
getting a result with 'mojo get' and a JSON pointer.

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to