Closed kskalski closed 7 years ago
Looks like last branch in handleMissingField (https://github.com/bivas/protobuf-java-format/blob/master/src/main/java/com/googlecode/protobuf/format/JsonFormat.java#L908) should check if tokenizer.currentToken() starts with ' or " instead of blindly calling consumeString
Can you please prepare a test and PR?
Merged #41
parsing something like { "unknown": [] }
fails with com.googlecode.protobuf.format.JsonFormat$ParseException: 1:32: Expected string. at com.googlecode.protobuf.format.JsonFormat$Tokenizer.parseException(JsonFormat.java:734) at com.googlecode.protobuf.format.JsonFormat$Tokenizer.consumeString(JsonFormat.java:683) at com.googlecode.protobuf.format.JsonFormat.handleMissingField(JsonFormat.java:909) at com.googlecode.protobuf.format.JsonFormat.handleMissingField(JsonFormat.java:895) at com.googlecode.protobuf.format.JsonFormat.mergeField(JsonFormat.java:853) at com.googlecode.protobuf.format.JsonFormat.mergeField(JsonFormat.java:875) at com.googlecode.protobuf.format.JsonFormat.merge(JsonFormat.java:790)