Hi David,

Here is a sample MessageBodyReader (and also Writer) that uses JSON-P to
parse some "custom" JSON code:
https://github.com/eclipse/microprofile-conference/blob/master/microservice-vote/src/main/java/io/microprofile/showcase/vote/api/AttendeeProvider.java

If you are writing this in a client, then you will need to register your
MBR with your client like this:
Client c = ClientBuilder.newClient();
c.register(AttendeeProvider.class);

Hope this helps,
Andy


On Tue, May 2, 2017 at 11:01 AM KARR, DAVID <[email protected]> wrote:

> I've written several small CXF JAX-RS services where I either designed it
> "code first" or "schema first".  In both cases, the resulting json was
> "conventional", so mapping from the json to pojos happened automatically.
>
> I'm now trying to write some client code that gets json data in an
> "unconventional" form.  I don't understand my options for customizing this
> process.  I think it's pretty clear I'll have to write a MessageBodyReader,
> and I'll probably be doing something with a JSON provider, but that's about
> all I can see.
>
> I posted about this at
> http://stackoverflow.com/questions/43728177/map-unconventional-json-to-pojo-with-cxf-jax-rs-client
> .
>
> In short, my json data looks something like this:
> ------------
> {
>     "addOnOffers": [
>         {
>             "offer": {
>                 "offerId": 4000
>             }
>         }
>     ]
> }
> ---------
>
> If I have to, I'll just get the json string from the response and use a
> plain json parser to extract the data, but I'd like to understand how to do
> this in the MessageBodyReader, and with the conventional facilities
> provided by CXF.
>

Reply via email to