users@jsonb-spec.java.net

[jsonb-spec users] [jsr367-experts] Re: simple value supported?

From: Martin Vojtek <voytoo_at_gmail.com>
Date: Tue, 8 Dec 2015 07:50:17 +0100

There has been some discussion in the past. In JSON-P 1.1, JsonReader has
new method:

default JsonValue
<file:///C:/repo/json-processing-spec~git/www/snapshots/1.1/javadocs/javax/json/JsonValue.html>
readValue()

Returns a JSON value that is represented in the input source. This method
needs to be called only once for a reader instance.
Returns:a JSON valueThrows:JsonException
<file:///C:/repo/json-processing-spec~git/www/snapshots/1.1/javadocs/javax/json/JsonException.html>
-
if a JSON value be created due to i/o error (IOException would be cause of
JsonException)JsonParsingException
<file:///C:/repo/json-processing-spec~git/www/snapshots/1.1/javadocs/javax/json/stream/JsonParsingException.html>
-
if a JSON value cannot be created due to incorrect representation
IllegalStateException
<http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalStateException.html?is-external=true>
-
if read, readObject, readArray, readValue or close method is already called
Since:1.1

On Mon, Dec 7, 2015 at 11:06 PM, Romain Manni-Bucau <rmannibucau_at_gmail.com>
wrote:

> Saw them and wonder how far it matches jsonp. JsonReader doesnt support
> them typically so from my window it looks inconsistent.
> Le 7 déc. 2015 22:33, "Dmitry Kornilov" <dmitry.kornilov_at_oracle.com> a
> écrit :
>
>> I don’t remember the discussion, but simple values are supported. There
>> are some samples in DefaultMapping.java.
>>
>> Dmitry
>>
>> > On 07 Dec 2015, at 19:02, Romain Manni-Bucau <rmannibucau_at_tomitribe.com>
>> wrote:
>> >
>> > Hi guys,
>> >
>> > didn't find in the archive if we discussed if we should support simple
>> values.
>> >
>> > Here few samples:
>> >
>> > assertEquals("\"strValue\"", JSONB.toJson(Optional.of("strValue")));
>> > assertEquals("null", JSONB.toJson(Optional.ofNullable(null)));
>> > assertEquals("null", JSONB.toJson(Optional.empty()));
>> > assertEquals("1", JSONB.toJson("1"));
>> >
>> > I think not JsonObject and JsonArray values shouldn't be supported but
>> > I know several mapper can support it.
>> >
>> > If it has been discussed happy to catch up with an archive link, if
>> > not what do you think?
>> >
>> > Romain Manni-Bucau
>> > @rmannibucau
>> > http://www.tomitribe.com
>> > http://rmannibucau.wordpress.com
>> > https://github.com/rmannibucau
>>
>>