Jaya Prakash

Jaya Prakash

  • 529
  • 2.2k
  • 51.1k

how to convert Json Result ?

Feb 27 2024 4:51 AM

i wanted to get my table data in json format and im getting it from db like below

JSON_F52E2B61-18A1-11d1-B105-00805F49916B
[
{"RequestID":"BB3AEUAT3","APITransactionID":"","BankTransactionID":"","CreatedDate":"2023-12-28T11:28:31.127","ServiceType":"CW"},
{"RequestID":"BB3AEUAT4","APITransactionID":"","BankTransactionID":"","CreatedDate":"2023-12-28T12:06:11.913","ServiceType":"CW"}
]

and result as shown in picture when i click on that result the extension for is .xml

im getting this result to my code behind through a procedure but im unable to get this result

In my DAL class getting empty how can i get this to my code behind

im getting null as above what should i do

and my procedure 

so i keep JSON AUTO to get result 

set @BaseQuery='insert into #basetable select * from ('+@BaseQuery+@datecheck+@statuscheck+@APIPartnerIDCheck+')as subquery ORDER BY RequestID DESC' 		  					  
exec sp_executesql @BaseQuery      
PRINT @BaseQuery

set @BaseQuery='select * from #basetable for JSON AUTO'      
exec sp_executesql @BaseQuery              

How can i get it to my code behind??


Answers (2)