Skip to content

Commit

Permalink
Fix #19 by making sure we treat forward slash as a valid escaped char…
Browse files Browse the repository at this point in the history
…acter
  • Loading branch information
quinnj committed Aug 2, 2019
1 parent 7756d8d commit 526f10e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/strings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Base.String(x::PointerString) = unsafe_string(x.ptr, x.len)
function reverseescapechar(b)
b == UInt8('"') && return UInt8('"')
b == UInt8('\\') && return UInt8('\\')
b == UInt8('/') && return UInt8('/')
b == UInt8('b') && return UInt8('\b')
b == UInt8('f') && return UInt8('\f')
b == UInt8('n') && return UInt8('\n')
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ JSON3.StructType(::Type{C}) = JSON3.Struct()
@test JSON3.read("[1,2,3]", Base.Array{Any}) == [1,2,3]
@test JSON3.read("[]", Vector{Any}) == []
@test JSON3.read("{}", Dict{Symbol, Any}) == Dict{Symbol, Any}()
@test JSON3.read("{\"a\":\"b\\/c\"}").a == "b/c"

@test_throws ArgumentError JSON3.read("hey", Any)
@test_throws ArgumentError JSON3.read("hey", String)
Expand Down

0 comments on commit 526f10e

Please sign in to comment.