Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samirbehara-zz/c27c401b59170a09ee01711d2c61040e to your computer and use it in GitHub Desktop.
Save samirbehara-zz/c27c401b59170a09ee01711d2c61040e to your computer and use it in GitHub Desktop.
--ISJSON() - To verify that the text has valid JSON data
DECLARE @json nvarchar(max)
SET @json =N'
{
"Person": [
{
"FirstName": "Gustavo",
"LastName": "Achong",
"AccountNumber": "AW00029484",
"ModifiedDate": "2014-09-12T11:15:07.263"
}
]
}'
IF (ISJSON(@json) = 1)
PRINT 'It is a Valid JSON' --Valid JSON
ELSE
PRINT 'It is an Invalid JSON string'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment