You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2014/12/01 14:30:35 UTC
Re: Marshalling of Strings in JSON
I've prototyped the following:
http://git-wip-us.apache.org/repos/asf/cxf/blob/25b66032/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/SimpleTypeJsonProvider.java
Cheers, Sergey
On 28/11/14 21:38, Aaron Titus wrote:
> oops that should have said "and that object class has the properties you
> previously wanted as your parameters"
>
> that makes more sense!
>
>
>
> On Fri, Nov 28, 2014 at 4:36 PM, Aaron Titus <at...@fwdco.com> wrote:
>
>> Yes, this is correct. Incoming REST parameters when simple strings should
>> be specified with the URL for get requestss and with a post they can be
>> form encoded. If you don't want to form encode but instead send a json
>> object then change the method so it takes a single object as its parameter,
>> and that object class has the parameters you want. This is the simplest
>> way to do it and will save Sergey some work ;-)
>>
>>
>> On Fri, Nov 28, 2014 at 10:34 AM, Benson Margulies <be...@basistech.com>
>> wrote:
>>
>>> Then you'd need your parameter to be, say, Map<String, Object>, or
>>> some class, not a plain string.
>>>
>>> On Fri, Nov 28, 2014 at 10:18 AM, Aaron Titus <at...@fwdco.com> wrote:
>>>> curly braces are object syntax. If you are using JAXB deserializer, it
>>>> needs an object to create, and therefore you'll have curly braces in the
>>>> json. The object can have properties that are primitives like boolean or
>>>> plain String objects and it works just fine for me but as I have stated
>>>> before I'm using JAXB annotations so this may have something to do with
>>> it.
>>>> I have not tried it with a pure Jackson mapper and JSON-only
>>> annotations.
>>>>
>>>>
>>>> On Fri, Nov 28, 2014 at 9:49 AM, Benson Margulies <benson@basistech.com
>>>>
>>>> wrote:
>>>>
>>>>> Of course it won't work with brackets. That is not the json syntax for
>>> a
>>>>> plain string.
>>>>> On Nov 28, 2014 9:47 AM, "Aaron Titus" <at...@fwdco.com> wrote:
>>>>>
>>>>>> I think the key is that I am using the JAXB annotations, and not the
>>>>> JAX-RS
>>>>>> ones. I am using jackson 2.2.3 now, but it was working also before
>>> with
>>>>>> 1.9. You include the databind jar, and then the JAXB serializer
>>> can use
>>>>>> the Jackson Provider. Specifically I'm using this one:
>>>>>>
>>>>>> com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>
>>
>>
>