You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by "Bernd Gutjahr (JIRA)" <ji...@apache.org> on 2018/11/22 09:34:00 UTC
[jira] [Commented] (JOHNZON-195) JsonWriter.write(JsonValue) fails
with simple values (strings, numbers, booleans)
[ https://issues.apache.org/jira/browse/JOHNZON-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16695714#comment-16695714 ]
Bernd Gutjahr commented on JOHNZON-195:
---------------------------------------
Looking great. Thanks a lot.
> JsonWriter.write(JsonValue) fails with simple values (strings, numbers, booleans)
> ---------------------------------------------------------------------------------
>
> Key: JOHNZON-195
> URL: https://issues.apache.org/jira/browse/JOHNZON-195
> Project: Johnzon
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.1.10
> Reporter: Bernd Gutjahr
> Assignee: Romain Manni-Bucau
> Priority: Minor
> Fix For: 1.1.11
>
>
> The following code snipped fails with a JsonGenerationException("Invalid json").
> {\{ try (JsonWriter jsonWriter = Json.createWriter(System.out))}}
> \{{ {}}
> {{ jsonWriter.write(Json.createValue("hello"));}}
> \{{ }}}
> I would have expected this code to write just the value to the output stream, e.g. "hello" in the above example. Reading such values via JsonReader.readValue() works fine and I wanted to write out any kind of values that have been read before.
> As a workaround, I'm currently using the JsonWriter only for types ARRAY and OBJECT and otherwise just use JsonValue.toString(), but I want to get rid of such ugly code.
> To fix the issue, I have created this pull request: [https://github.com/apache/johnzon/pull/32]
>
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)