Jump to content

SQL Server 2016 Json parsing super man...


loveindia

Recommended Posts

28 minutes ago, loveindia said:

non - relational representation of data man... similar to xml but more advanced and easy to understand.. 15xx4n.gif

LOL ....  super chearu sir ....

 

JSON is Java Script Object Notation , so nothing but JSON is javascript object 

Link to comment
Share on other sites

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

  • loveindia

    17

  • k2s

    3

  • Kontekurradu

    3

  • yomama

    3

Top Posters In This Topic

Just now, yomama said:

Asal Json em doing uncle analyze ante how? I see customer address testunav but did get what Ur doing??

so just imagine, you have a webpage where you have the option to update your address or a api call that will send JSON data to add a new customer and so on... earlier since Json is not available in SQL Server, you have to either convert it to XML and then do via SQL or insert by means of application code only... so enta complex logic untey application code anta complex avutundey and there is no more concept of batch processing... and JSON is highly in demand now... so Microsoft started getting that into T-SQL straight... now just JSON pass chestey chalu I can interpret the data myself and work with it and it will faster than the application level of using it man....  15xx4n.gif

Link to comment
Share on other sites

Atlane koncham R ela install cheyyalo kuda cheppuko sodara 2016 loo vadakam tarvatha nerchukundam R nerchukovadam valla upayogam endii

Ivi kooda touch chesthe cheppu brooo Azure and Hadoop related tasks in SSIS .. 

Link to comment
Share on other sites

44 minutes ago, loveindia said:

If you are using Json and SQL Server 2016, its an awesome combo man... I am using it hands on currently and super experience so far... just a quick example for newbies interested in this...

 


	DECLARE @Json NVARCHAR(MAX)
	SET @Json = '{"requests": [
	    {
	      "id": 0,
	      "data": [
	        {
	          "id": 0,
	          "field": "customerAddress",
	          "stringValue": "2301 Perf. Drive"
	        }
	      ],
	      "where": [
	        {
	          "id": 0,
	          "field": "customerid",
	          "intValue": 1
	        },
	        {
	          "id": 1,
	          "field": "isActive",
	          "stringValue": "1"
	        }
	      ],
	      "table": "custAddress"
	    },
	    {
	      "id": 1,
	      "data": [
	        {
	          "id": 0,
	          "field": "customerAddress",
	          "stringValue": "111 West Irving"
	        }
	      ],
	      "where": [
	        {
	          "id": 0,
	          "field": "customerid",
	          "intValue": 2
	        },
	        {
	          "id": 1,
	          "field": "isActive",
	          "stringValue": "1"
	        }
	      ],
	      "table": "custAddress"
	    }
	    ]
	}    '
	;WITH CTE AS
	(
	SELECT *
	FROM OpenJson(@Json, '$.requests')
	)
	SELECT a.[key]
	    , JSON_VALUE(b.[value], '$.field') AS update_field
	    , JSON_VALUE(b.[value], '$.stringValue') AS update_value
	    , JSON_VALUE(c.[value], '$.field') AS where_field
	    , ISNULL(JSON_VALUE(c.[value], '$.stringValue'), JSON_VALUE(c.[value], '$.intValue')) AS where_value
	FROM CTE a
	CROSS APPLY OpenJson(a.[value], '$.data') b
	CROSS APPLY OpenJson(a.[value], '$.where') c
	

 

pola adiri pola..  sivaji-sunglasses-o.gif

explain more man... why JSON integration is useful in 2016 vs compared to older versions ? older versions lo how do you the achieve the same w/o JSON ?

Link to comment
Share on other sites

Just now, k2s said:

pola adiri pola..  sivaji-sunglasses-o.gif

explain more man... why JSON integration is useful in 2016 vs compared to older versions ? older versions lo how do you the achieve the same w/o JSON ?

older version lo there is no straight forward JSON support daddy man... you have to write your own JSON libraries a.k.a functions to parse this JSON, its a tedious task and it will be game over for a newbie... SQL with XML parsing was better till that time, so JSON ni XML object ga convert chesi ichevallu... but now that conversion time can taken off by using SQL 2016...  15xx4n.gif

Link to comment
Share on other sites

my work place also we are mostly using jason but parsing is done hadoop side from there we are bring it into sql server good stuff loveindia

Link to comment
Share on other sites

19 minutes ago, sri_india said:

LOL ....  super chearu sir ....

 

JSON is Java Script Object Notation , so nothing but JSON is javascript object 

lol I am not talking about the JSON full form man, I am talking about how data inside is present it... JSON ki full form ye kaavali antey google cheskovachu man.... application side object antaru, database side daanney data antaaru man... just general ga human readable terms lo cheppanu man...15xx4n.gif

Link to comment
Share on other sites

3 minutes ago, loveindia said:

older version lo there is no straight forward JSON support daddy man... you have to write your own JSON libraries a.k.a functions to parse this JSON, its a tedious task and it will be game over for a newbie... SQL with XML parsing was better till that time, so JSON ni XML object ga convert chesi ichevallu... but now that conversion time can taken off by using SQL 2016...  15xx4n.gif

so antey,,, now i can write my T-queries in JSON ani a ? 

or only Add/delete/change ki this JSON approach is super handy ani a?

Link to comment
Share on other sites

2 minutes ago, chelsea said:

my work place also we are mostly using jason but parsing is done hadoop side from there we are bring it into sql server good stuff loveindia

cool man... Ya hadoop tho integrate aindi gaa starting with 2016 so direct Odata Feeds kuda read chesey andukey start chesadu idi... clients using sql server will go up by good number with this move...  15xx4n.gif

Link to comment
Share on other sites

5 minutes ago, k2s said:

so antey,,, now i can write my T-queries in JSON ani a ? 

or only Add/delete/change ki this JSON approach is super handy ani a?

that means you can query the JSON directly and treat it as data directly... earlier you have to read json and then parse it to an intermediate table(which is dead slow) and then do the operations... now since this is all inbuilt, you can start directly treating the JSON as final version of data and do what ever you like to do with that data man...  15xx4n.gif

Link to comment
Share on other sites

1 minute ago, loveindia said:

that means you can query the JSON directly and treat it as data directly... earlier you have to read json and then parse it to an intermediate table(which is dead slow) and then do the operations... now since this is all inbuilt, you can start directly treating the JSON as final version of data and do what ever you like data man...  15xx4n.gif

aliok.gif

Link to comment
Share on other sites

6 minutes ago, loveindia said:

lol I am not talking about the JSON full form man, I am talking about how data inside is present it... JSON ki full form ye kaavali antey google cheskovachu man.... application side object antaru, database side daanney data antaaru man... just general ga human readable terms lo cheppanu man...15xx4n.gif

Java Script Object Notation antee neeku JSON full form laaga anipisthy .... ok sir , 

Link to comment
Share on other sites

Just now, sri_india said:

Java Script Object Notation antee neeku JSON full form laaga anipisthy .... ok sir , 

ok man... aitey neeku telisindi ento cheppu... nenu kaadu analedu ga..15xx4n.gif

Link to comment
Share on other sites

can you store json or is this just for processing json and saving to tables?    most people will do that from business logical layer. a nice feature to have but I don't see that many use cases

Link to comment
Share on other sites

1 minute ago, stockdazzler said:

can you store json or is this just for processing json and saving to tables?    most people will do that from business logical layer. a nice feature to have but I don't see that many use cases

you can json also man like you do XML... Json is not just for saving to tables man... you can create reports out of it or you can build dashboards (basically collection of reports) also on a large scale if needed...  15xx4n.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...