How do I remove the "JSON_" key in front of responses that were formatted with "FOR JSON PATH"
See original GitHub issueIām executing a stored procedure which contains a select statement that uses for json path, root('error')
and returns info if an error was raised.
I get this: {JSON_F52E2B61-18A1-11d1-B105-00805F49916B: '{"error":[{"ErrorNumber":50ā¦"
Instead of this: '{"error":[{"ErrorNumber":50ā¦"
Is there a driver option to remove that exterior āJSON_ā wrapper?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
how to remove json object key and value.? - Stack Overflow
There are several ways to do this, lets see them one by one: delete method: The mostĀ ...
Read more >What is JSONPath and How to query JSON using ... - Tools QA
JSON , like XML, is a format to provide structure to the data. If you are not familiar with JSON, please go through...
Read more >Format Query Results as JSON with FOR JSON - SQL Server
In this article. Option 1 - You control output with FOR JSON PATH; Option 2 - SELECT statement controls output with FOR JSON...
Read more >Using JSONPath effectively in AWS Step Functions
This blog post explains how you can effectively use JSONPath in a Step Functions workflow. It shows how you can separate concerns between...
Read more >JSON Syntax - W3Schools
JSON - Evaluates to JavaScript Objects. The JSON format is almost identical to JavaScript objects. In JSON, keys must be strings, written with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
š @NamedArray
JSON_F52E2B61-18A1-11d1-B105-00805F49916B
is the column name that SQL Server uses to send back JSON data, and as you noticed, the data is sent back as a regular string.If you want to actually use this data in your application, you need to pass the string to
JSON.parse
as part of your query result handling. Automatic handling for this wonāt be added totedious
, because we canāt know what the userās intentions are, and serializing JSON is a rather expensive operation.Please let us know if you have any further questions. šāāļø
Hi @NamedArray,Thank you for all the details. Just run a query using Sql Server Management Studio with a āfor Jsonā key word : āselect colname from table for json pathā . In my result set, it also has a āJSON_ā prefix. Could this be a common behavior for this key word, and not caused by tedious? This is screen shot for my output :
I also found a page from Microsoft doc that related to this: https://docs.microsoft.com/en-us/sql/relational-databases/json/format-query-results-as-json-with-for-json-sql-server?view=sql-server-ver15 . The examples in this page also includes the āJSON_ā prefix.