Tnx! I'll check it out and let you know.



Check out Jackson [1] and also GSON [2].

There are two main approaches:

* first optoin is just to parse the JSON into a bunch of lists and maps.
Jackson describes how to do this here [3]

* alternatively, if you want to be a little more type-safe, then what you
can do is to define a set of pojos that correspond to the structure of the
JSON, and then deserialize the JSON into the pojos.  If the JSON is a
little unusual then they also offer APIs to allow you to write custom
deserializers.

HTH
Dan


[1] https://github.com/FasterXML/jackson
[2] https://code.google.com/p/google-gson/
[2]
https://github.com/FasterXML/jackson-databind#3-minute-tutorial-generic-collections-tree-model








On 30 March 2015 at 17:08,  wrote:

> Hi Dan,
>
>
>
> I did a very simple implementation with Jersey Client Api in simple app
> the way you reccomended and it works fine indeed.
>
> Any recommandation of how parse the JSON returned? Are you using libs for
> that purpose in ISIS already?
>
>
>
> grtz Johan
>
>
>
>
>
>
>
>
> Um, not sure I agree that a view model is relevant if acting as a consumer
> of an external REST API.
>
> Put another way: it's perfectly fine for entities or regular domain
> services to act as consumers of external REST APIs, too.
>
> What I would do is to create a domain service that actually makes the REST
> call, so that this can be tested in isolation.  That domain service can
> then provide a suitably simplified API for the other domain objects that
> need info from that service.
>
> HTH
> Dan
>
>
>
> On 30 March 2015 at 10:44, Martin Grigorov  wrote:
>
> > Hi Johan,
> >
> > Using a viewmodel should work.
> > Recently someone complained that the action method (or maybe the
> > constructor of the viewmodel?!) has been invoked twice per http request.
> > Check whether this happens for you too and give us more details so we can
> > optimize it. For more info check the mail archives from the past two
> weeks.
> >
> > Martin Grigorov
> > Freelancer, available for hire!
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Mon, Mar 30, 2015 at 12:37 PM,  wrote:
> >
> > > I would like to consume data from an external REST-api (JSON like from
> > > http://api.postcodeapi.nu/) and use it in ISIS. Can anybody recommend
> a
> > > sensible approach?
> > >
> > >
> > >
> > > grtz Johan
> > >
> > >
> > >
> > >
> > >
> > >
> >
>
>
>
>

         

Reply via email to