Hello Sodi, Deepthika,
Welcome to the Microsoft Q&A forum.
To store JSON responses received from a web activity in an Azure SQL table while preserving special characters, make sure that the JSON response is passed as a string to the stored procedure.
You can use the REPLACE
function to replace backslashes with double backslashes before using OPENJSON
.
CREATE PROCEDURE StoreJsonData
@json NVARCHAR(MAX)
AS
BEGIN
SET @json = REPLACE(@json, '\', '\\')
INSERT INTO YourTable (name, description)
SELECT name, description
FROM OPENJSON(@json)
WITH (
name NVARCHAR(50),
description NVARCHAR(255)
)
END
and call the stored procedure and pass the JSON string as a parameter.
I hope this helps.