javascript - How to check if a string is a valid JSON string?

Published: 08 April 2024
on channel: Code Samples
64
0

isJsonString('{ "Id": 1, "Name": "Coke" }')

should be true and
isJsonString('foo')
isJsonString('divfoo/div')

should be false.
I'm looking for a solution that doesn't use try/catch because I have my debugger set to "break on all errors" and that causes it to break on invalid JSON strings.
https://github.com/douglascrockford/J... https://github.com/douglascrockford/J...
comment of @Mrchief: https://stackoverflow.com/questions/3...


On this page of the site you can watch the video online javascript - How to check if a string is a valid JSON string? with a duration of hours minute second in good quality, which was uploaded by the user Code Samples 08 April 2024, share the link with friends and acquaintances, this video has already been watched 64 times on youtube and it was liked by 0 viewers. Enjoy your viewing!