You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using HJson to parse regular Json files and found an issue with control characters in Strings.
The input file looks like
{ "aaa" : "xxx\u000byyy" }
and we parse it with HJson. When the resulting JsonValue object is written using toString() or toString(Stringify.FORMATTED) the output contains invalid control characters. It is expected that these control characters are quoted using \u again according to Json standard.
0000 0A 7B 0A 20 20 22 61 61 61 22 3A 20 22 78 78 78 .{. "aaa": "xxx0010 0B 79 79 79 22 0A 7D -- -- -- -- -- -- -- -- -- .yyy".}
Exception in thread "main" org.hjson.ParseException: Expected valid string character at 3:13
at org.hjson.HjsonParser.error(HjsonParser.java:500)
at org.hjson.HjsonParser.expected(HjsonParser.java:494)
at org.hjson.HjsonParser.readStringInternal(HjsonParser.java:292)
at org.hjson.HjsonParser.readString(HjsonParser.java:282)
at org.hjson.HjsonParser.readValue(HjsonParser.java:117)
at org.hjson.HjsonParser.readObject(HjsonParser.java:199)
at org.hjson.HjsonParser.readValue(HjsonParser.java:119)
at org.hjson.HjsonParser.parse(HjsonParser.java:88)
at org.hjson.JsonValue.readHjson(JsonValue.java:130)
at de.softquadrat.jdbc.json.Test.main(Test.java:13)
The 0B character (Ctrl-K) in the generated Json is invalid. It should be quoted as \u000b. HJson is unable to parse the Json generated by itself and throws the ParseException.
The text was updated successfully, but these errors were encountered:
Thanks for the detailed issue description, I'll have a look. The issue seems to be specific for the Java implementation of Hjson so I transferred the issue to the hjson-java repository.
We are using HJson to parse regular Json files and found an issue with control characters in Strings.
The input file looks like
and we parse it with HJson. When the resulting JsonValue object is written using toString() or toString(Stringify.FORMATTED) the output contains invalid control characters. It is expected that these control characters are quoted using \u again according to Json standard.
This example program shows the problem:
The output of the test program gives:
The 0B character (Ctrl-K) in the generated Json is invalid. It should be quoted as \u000b. HJson is unable to parse the Json generated by itself and throws the ParseException.
The text was updated successfully, but these errors were encountered: