You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by "Romain Manni-Bucau (JIRA)" <ji...@apache.org> on 2018/11/22 08:56:00 UTC
[jira] [Resolved] (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:all-tabpanel ]
Romain Manni-Bucau resolved JOHNZON-195.
----------------------------------------
Resolution: Fixed
Applied with some tweak on the generator, can you have a quick look all is ok on your side please? And thanks a lot for the patch!
> 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
>
> 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)