JuliaIO / JSON.jl

JSON parsing and printing
Other
313 stars 101 forks source link

check if a given String is valid json #323

Open untoreh opened 3 years ago

untoreh commented 3 years ago

I was looking for an isjson(::String) function that checks for valid json, such that I can walk over an HTML tree to check nodes for json scripts without exception handling

quinnj commented 3 years ago

As somewhat of an interesting historical relic, HTTP.jl has a isjson function; it could perhaps be repurposed and included in the package here: https://github.com/JuliaWeb/HTTP.jl/blob/209f10eaa0d51372e0ed7f6127bff7a37047349d/src/sniff.jl#L287