Do we have any consensus on this? Should I submit a PR with the change?

> On Oct 28, 2016, at 6:51 AM, Graeme Rocher <graeme.roc...@gmail.com> wrote:
> 
> one thing to note. I would assume if we allow JsonOutput.unescaped it
> would the convert method would have to return Object? Currently the
> JsonUnescaped type doesn't implement CharSequence
> 
> If that is the case it may also be interesting to support return types
> of Writable since.
> 
> Cheers
> 
> On Fri, Oct 28, 2016 at 12:46 PM, Graeme Rocher <graeme.roc...@gmail.com> 
> wrote:
>> Yeah I agree JsonOutput.unescaped allows the same flexibility without
>> compromising the most common use case.
>> 
>> Cheers
>> 
>> On Tue, Oct 25, 2016 at 10:32 PM, John Wagenleitner
>> <john.wagenleit...@gmail.com> wrote:
>>> On Tue, Oct 25, 2016 at 12:07 PM, James Kleeh <james.kl...@gmail.com> wrote:
>>>> 
>>>> Currently if one were to register a converter with options like so:
>>>> 
>>>> JsonGenerator.Options options = new JsonGenerator.Options()
>>>> options.addConverter(MyCustomType) { MyCustomType mct ->
>>>>    mct.name
>>>> }
>>>> 
>>>> 
>>>> Assuming “mct.name” returns a string, it will be output without quotes
>>>> because of:
>>>> 
>>>> Converter converter = findConverter(objectClass);
>>>> if (converter != null) {
>>>>    writeRaw(converter.convert(object, key), buffer);
>>>>    return;
>>>> }
>>>> 
>>>> I’d be curious to hear what the use case is for outputting the data as
>>>> raw. I think the percentage of users that would prefer to have their data
>>>> further processed by that method would vastly outnumber the ones that do
>>>> not.
>>>> 
>>>> I think something like this would be a better solution:
>>>> 
>>>> Converter converter = findConverter(objectClass);
>>>> if (converter != null) {
>>>>    object = converter.convert(object, key);
>>>> }
>>>> 
>>>> Thoughts?
>>> 
>>> 
>>> 
>>> I had aimed for making it as flexible as possible and purposefully had it
>>> not participate in further processing to avoid surprises and be able to
>>> output JSON that otherwise wouldn't be possible due to the way the generator
>>> was already configured (nulls or being able to write out a number such as
>>> 9.3e7).
>>> 
>>> I like your suggestion and think the flexibility could still be accomplished
>>> using JsonOutput.unescaped; and since 2.5 isn't out yet there's still time
>>> to refine how it works.
>>> 
>>> I also would like to hear what others think.
>>> 
>>> John
>> 
>> 
>> 
>> --
>> Graeme Rocher
> 
> 
> 
> -- 
> Graeme Rocher

Reply via email to