Hello Ben,
thank you for this hint. Nearly what I want. So maybe some more background:
I have some .csv files including my data structures:

Object1;1;DE
Object2;2;DE

I would like to parse these files, and create a json document. My first
quick&dirty try was simply to put this directly to a well formated
json-String and get it rendered.
I guess this was too quick&dirty ;-)

BR Martin

2017-03-02 15:53 GMT+01:00 Ben van Staveren <[email protected]>:

> 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].
> 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.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Mojolicious" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/mojolicious/lcWSKwtNx2Q/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
>

-- 
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