Yes,

my $object = { Objects => [ Object1 => { Number => 1, countryCode => 'DE' }, Object2 => { Number => 2 } ] };

$c->render(json => $object)


Will do what you want; just pass it the raw perl structure :)


On 3/2/2017 3:44 PM, Martin P wrote:
Hello folks,
I'm quite new to Mojolicious, and currently struggling with correct rendering.
Is it possible to render json-formated strings in perl?

something like:
$myString = "{Objects => [Object1 => {Number => 1, countryCode => "DE"},Object2 => {Number => 2, countryCode => "DE"}]}"
$c->render(json => $myString);

If a try to do it in this way I get a quoted string back, instead of a well formated json document :-(

Any advices???

BR Martin
--
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] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to