Questions tagged [json-value]

77 questions
0
votes
1 answer

How to compare the fields present in two json response and validate it?

I need to compare all the countries present in Response1 should be present in Response2 also. So How Can I take all the countries from both the responses and validate? I tried on storing country in ArrayList but not able to validate it. Json…
0
votes
0 answers

How to extract values with TSQL json_value( ) on string {"key":"key1","value":"value1"}

Thank you in advance for answering my questions. I need to extract value using TSQL json_vlaue() from col1 = [{"key":"key1","value":"value1"}, {"key":"key2","value":"value2"}, ...] I can extract value like json_value(col1, '$[0].Value'),…
fei
  • 1
0
votes
1 answer

SQL:Finding max value from a nested JSON in SQL Server

This question has a reference in this SO thread. I want compute the MAX() value of the below JSON. Also the keys in this are not fixed hence as per the above solution they can't be hardcoded in the code. DECLARE @json nvarchar(max) = ''{"value": [ …
pythondumb
  • 1,187
  • 1
  • 15
  • 30
0
votes
1 answer

How to use OPENJSON Method with nested JSON having undetermined/dynamic path?

I'm working with an API that spits out a data in the form of dynamic json i.e. the location of some elements of json objects is not fixed, this leads to the path some elements in json arrays being dynamic. For example in the JSON object below the…
Walter
  • 79
  • 6
0
votes
1 answer

Parse nested Json data into a SQL Server table

I have a column JsonObject in the t table. I need to parse this JsonObject column which has JSON values in the array. My first solution is: SELECT JSON_VALUE(JsonObject, '$.Id') AS Id, JSON_VALUE(JsonObject, '$.Provider') AS Provider, …
burcubelen
  • 23
  • 7
0
votes
2 answers

Oracle Execute immediate JSON path expression syntax error

I want to loop through a Json string to retrieve values. The following code gives me a JSON path expression error. declare buffer clob; pos number; Numb number; begin pos := 1; buffer :=…
0
votes
1 answer

Azure SQL: get all values of JSON of a column

I have simplified my problem for the sake of this question, I am trying to get all the ReferenceId and Options values of the JSON using SQL but I am getting NULL. Can someone help me with this? DECLARE @jsonInfo VARCHAR(MAX) SET…
OTUser
  • 3,788
  • 19
  • 69
  • 127
0
votes
1 answer

Querying One Dimensional JSON string

I'm trying to check to see if a one dimensional array string like: [1,2,3,4,5] contains a certain value, like 4. I know with multi-dimensional arrays I could do something like: JSON_VALUE(columnName, '$.key') but for the life of me, I can't figure…
Brds
  • 1,035
  • 3
  • 17
  • 37
0
votes
1 answer

Adding Classes to Dynamic JSON Values

I have a list of dynamic users with various occupations in a variety of industries, depending on their industry (health, education, construction, science, etc), I would like to add a color badge that is displayed dynamically depending on industry…
0
votes
2 answers

JSON Value - Oracle PL/SQL : Multiple Fields

I have a HCLOB with below sample entry "relist":[{"name":"XYZ","action":["Manager","Specific User List"],"flag":false}] When I try to get name or flag using JSON_VALUE I am able to get it as it has single field , but I want to get the value for…
user2854333
  • 640
  • 6
  • 20
0
votes
4 answers

How to use Oracle JSON_VALUE

I'm working on a trigger. declare v_time number(11, 0); begin for i in 0..1 loop select JSON_VALUE(body, '$.sections[0].capsules[0].timer.seconds') into v_time from bodycontent where contentid=1081438; dbms_output.put_line(v_time); end…
Junseok Lee
  • 49
  • 3
  • 10
0
votes
2 answers

How to fix SQL server JSON_VALUE path has '-' error

I'm trying to get values of fields in sql that is in JSON type. unfortunately path has '-' so that I get an error when I try to get the value. field->** **{"Con":["AA"],"X-Location-Latitude":["55.06"]} When I try to get json value with below…
Zeir
  • 249
  • 1
  • 4
  • 13
0
votes
1 answer

How to parse a json string to flat rows in SQL Server?

I have data like below in a file which I read into a variable in SQL Server: { "TypeCode": [ { "DestinationValue": "Private", "SourceValue": "1" }, { "DestinationValue": "Public", "SourceValue": "2" …
user12823830
0
votes
1 answer

how to add key-value pair in json root node and convert it into table using SQL server

I have table people and it's maintain Four column which is Name ,TagName ,Value , Location. I want to convert the tagname and value in json with name and location column as rootnode (Name & location same for multiple records) Need output as : { …
0
votes
1 answer

JSON_VALUE does not take dynamic JSON path

I am using SQL Server 2016. While this works fine: SELECT JSON_VALUE(N'[{"FieldName":"xyz"}]', N'strict $[0]."FieldName"') This retruns an error: DECLARE @x nvarchar(100) SET @x =N'0' SELECT JSON_VALUE(N'[{"FieldName":"xyz"}]', N'strict…
Ephedra
  • 831
  • 10
  • 24