Skip to content

Commit

Permalink
More efficient decoding of booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
plokhotnyuk committed Feb 24, 2025
1 parent 837fa29 commit 1501d40
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zio-json/shared/src/main/scala/zio/json/internal/lexer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ object Lexer {
def boolean(trace: List[JsonError], in: OneCharReader): Boolean = {
val c = in.nextNonWhitespace()
if (c == 't' && in.readChar() == 'r' && in.readChar() == 'u' && in.readChar() == 'e') true
else if (c == 'f' && in.readChar() == 'a' && in.readChar() == 'l' && in.readChar() == 's' && in.readChar() == 'e') false
else if (c == 'f' && in.readChar() == 'a' && in.readChar() == 'l' && in.readChar() == 's' && in.readChar() == 'e')
false
else error("expected a Boolean", c, trace)
}

Expand Down

0 comments on commit 1501d40

Please sign in to comment.