Skip to content

Tag: json

mysql – Search for a key within inconsistent json structure

I know of the functions such as: JSON_SEARCH() and JSON_EXTRACT() etc. This issue is that I am searching for a key in a json string that is not standardized. for example: and the results could be something like this: so in this example I want to get john doe with the acctNum of 123. but, also, the location of…

Mysql comma seperated to json-array

I have some fields in the database that are comma selerated, something like: a,b,c,d,e and I want to convert them into: I know how to do it in nodejs / any other language, but I need to do it directly on the mysql Possible? Thanks Answer The simplest approach probably is to use string functions only: Basicall…

How to include OPENJSON in View?

My JSON object is stored in the table (single cell). Right now, I’m reading the cell and saving the value to @json NVARCHAR(MAX) , but that obviously doesn’t work in views. How can I do something like this? Answer You can use cross apply to apply openjson() to each and every row of your table:

Nested JSON parsing using Snowflake SQL

I have a problem parsing a certain nested JSON structure in Snowflake. The problem here is the usage of special characters like @ and # for example for some of the elements. Those characters prevents me from using simple dot notation when trying to access some of the elements without resourcing to a really co…

Datetime changing on JSON response

I am selecting start and end date of a project from project_stage named table. Here is the table elements Here datatype is DATETIME Here is the code Result on JSON response Here date time is changing its not the actual datetime which is in the table,why the date is changing on result.Here is the expected outp…