Retrieve JSON Data from SQL Server using a Stored Procedure and C#

2 Comments

  1. Thanks for this tuto.

    I have a problem :

    When I run my stored procedure in TSQL, it is fine :

    [{“pseudo”:”John”,”age”:85,”city”:”LYON”,”country”:”FR”},{“pseudo”:”Stève”,”age”:30,”city”:”NANTES”,”country”:”FR”}]

    But in c#, the result have escaped chars :

    “[{\”pseudo\”:\”John\”,\”age\”:85,\”city\”:\”LYON\”,\”country\”:\”FR\”},{\”pseudo\”:\”Steve\”,\”age\”:30,\”city\”:\”NANTES\”,\”country\”:\”FR\”}]”

    My code is basically the same as you..

  2. Author

    Hi Steve, sorry about my slow reply. Did you find an answer to your problem? Are you checking the variable contents in a breakpoint? If that is the case the escape characters are expected. If you output the JSON string to the console or use it elsewhere it should not contain the escape characters.

Leave a Reply (Markdown formatting available)

This site uses Akismet to reduce spam. Learn how your comment data is processed.