title: Json input of a stored Procedure
body: <p>I have a Stored Procedure with a JSON in input ,Is it possible to use the JSON  as input for a stored procedure? how could i do that ?</p>
  <pre><code>CREATE PROCEDURE [warm].[stored _table]  
   (
    @Json NVARCHAR(MAX)
    )
    AS
    BEGIN
    SET NOCOUNT ON;
    BEGIN TRY
         BEGIN
  
          WITH JsonToTable AS 
          (
              SELECT * FROM OPENJSON (@Json) WITH (
                  [type] [nvarchar](100), 
                  [source] [nvarchar](38), 
                  [time] [nvarchar](28), 
                  [ID] [varchar](50) '$.data.ID',
                  [RegionCode] [varchar](10)'$.data.RegionCode'
                  [DueDate] [datetime2](7)'$.data.DueDate',
                  [SchedulStartDate] [datetime2](7)'$.data.SchedulStartDate',
              
                  
              )
          )
  
          MERGE [warm].[table] AS TARGET 
          USING JsonToTable AS SOURCE 
          ON (TARGET.ID = SOURCE.ID)
          WHEN MATCHED THEN
           UPDATE SET 
          TARGET.[RegionCode]                 = (SOURCE.[RegionCode]
          TARGET.[DueDate]                 = [dbo].[ufn_cast_string_to_date](SOURCE.[DueDate])
         ,TARGET.[SchedulStartDate]        = [dbo].[ufn_cast_string_to_date](SOURCE.[SchedulStartDate])
        
          
          
          WHEN NOT MATCHED THEN
              INSERT 
                  (
                   [SourceID]
                  ,[ID]
                  ,[RegionCode]
                  ,[DueDate]
                  ,[SchedulStartDate])
              VALUES
                  (
                   1
                  ,[ID]
                  ,[RegionCode]
                  ,[dbo].[ufn_cast_string_to_date](SOURCE.[DueDate])
                  ,[dbo].[ufn_cast_string_to_date](SOURCE.[SchedulStartDate])
       );                 
  
      END
      END TRY
     
      END
  </code></pre>
  <p>I Want to execute it with the request below  :</p>
  <pre><code>    DECLARE @return_value int
      EXEC    @return_value = [warm].[usp_upsert_warm_table]
      @Json = N'{
  &quot;type&quot; : &quot;table&quot;,
  &quot;source&quot; : &quot;informations&quot;,
  &quot;time&quot; : &quot;2018-04-05T17:31:00Z&quot;,
  &quot;id&quot; : &quot;A11-111-111&quot;,
  &quot;data&quot; : {&quot;
   &quot;ID&quot;:&quot;123-56&quot;,
   &quot;RegionCode&quot;:&quot;2&quot;,
   &quot;DueDate&quot;:&quot;2020-13-14T10:54:00&quot;,
   &quot;SchedulStartDate&quot;:&quot;2020-12-14T10:54:00&quot; 
    }'}
  </code></pre>
  <p>I get this Message Error :</p>
  <blockquote>
  <p>JSON text is not properly formatted. Unexpected character '.' is found at position 480.**</p>
  </blockquote>