Questions tagged [json-query]

Use this tag for tasks involving queries against a JSON document, such as extracting JSON components from a JSON text. The tag can also be used for query languages intended for specifying such queries.

254 questions
0
votes
1 answer

JSON Many to Many RelationShip Group By

I'm trying to create an SQL query allowing me to do this: I have 3 tables in SQL Server 2017: CREATE TABLE [dbo].[PRODUCTCATEGORY] ( [PROD_ID] [int] NOT NULL, [CAT_ID] [int] NOT NULL CONSTRAINT [PK_PRODUCTCATEGORY] PRIMARY KEY…
fanfan1973
  • 11
  • 3
0
votes
1 answer

question about extracting variables from json

I have bellow json output: I have to get "holders"("VG_ROOT-var", "VG_ROOT-root", "VG_ROOT-tmp") from all sd* drives * tries to use something like this in ansible: "gather_host_facts_result.ansible_facts.ansible_devices.sd*" unfortunately at this…
Kalina
  • 1
  • 1
0
votes
1 answer

Extract value from Ansible task output and create a variable from it

I use elb_application_lb_info module to get info about my application load balancer. Here is the code I am using for it: - name: Test playbook hosts: tag_elastic_role_logstash vars: aws_access_key: AKIARWXXVHXJS5BOIQ6P aws_secret_key:…
mudricd
  • 133
  • 1
  • 9
0
votes
1 answer

Ansible debug msg in a specific format

I have the below script, which does a ping. - name: Running WAN connectivty checks on WAN-01A cisco.ios.ios_ping: vrf: '{{item.vrf}}' dest: '{{item.destination}}' source: '{{item.source}}' count:…
netv
  • 165
  • 2
  • 12
0
votes
1 answer

ansible, jinja2, json - Using json_query in Jinja?

Hello Developer Community! I'm currently working on developing some Ansible playbooks to manage Citrix NetScaler configuration and would like to get some help about the following. I have the following data structure defined in a variable…
Belabacsi
  • 121
  • 2
  • 10
0
votes
1 answer

Remove elements from a JSON array, with no key

I'm looking for a way that I can remove elements from a JSON array in SQL Server, I tried using JSON_MODIFY/OPENPATH, but I can't seem to get the path parameter correct. Here is an example of what I want to do is…
John McDonnell
  • 753
  • 1
  • 8
  • 24
0
votes
1 answer

T-SQL JSON: JSON_QUERY is returning a json string after comparing the object with a string

I'm trying to return a JSON_QUERY field only if the JSON contains a specific field/property, but when I compare it with a string (that is the field's name), the function doesn't returns a JSON... Single code without comparison: SELECT Field1,…
0
votes
1 answer

Ansible json_query to filter data on dict of list of dict

I have an Ansible task which collects users data based on certain condition and registers the out to a variable and trying to iterate the registered data in the next task to just get the name parameter alone. { "registered_data": { …
Karthi1234
  • 949
  • 1
  • 8
  • 28
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
2 answers

Get document by min size of array in Mongodb

I have mongo collection: { "_id" : 123, "index" : "111", "students" : [ { "firstname" : "Mark", "lastname" : "Smith"), } ], } { "_id" : 456, "index" : "222", "students" : [ …
0
votes
1 answer

SQL Sever 2016 - Inconsistent Behavior - The argument 2 of the "JSON_VALUE or JSON_QUERY" must be a string literal

We are using SQL Server 2016 and I wrote a function that uses the following code: IF @JsonString IS NULL OR LTRIM(RTRIM(@JsonString)) = '' BEGIN RETURN NULL; END DECLARE @ArrayValues VARCHAR(100); SELECT @ArrayValues = …
crimsonisland
  • 21
  • 1
  • 4
0
votes
1 answer

Query SQL column with json values

I have this JSON value stored in SQL text column: [ { "Id": 1807080, "InvoiceId": 1605555, "UnitRate": 6924.00, "Total": 6924.00 }, { "Id": 1807081, "InvoiceId": 1605555, "UnitRate": 16924.00, "Total": 16924.00 …
Laziale
  • 7,965
  • 46
  • 146
  • 262
0
votes
2 answers

SQL Server : SELECT JSON Column in this JSON Structure

I would like to know will it possible to select data from below JSON structure? [ { "A": 6, "Status": 1 }, { "A": 3, "Status": 0 }, { "A": 6, "Status": 1 }, { …
tsohtan
  • 830
  • 1
  • 13
  • 33
0
votes
1 answer

How to pass ansible_query results to an included_task

I wish to extract a virtual-machine name and os-type from a list in my vars/main.xml file. I wish to pass the virtual-machine name and os-type to an include-tasks file that has tasks to include vars from a vars file named and then…
dubby
  • 51
  • 1
  • 6
0
votes
2 answers

Extract Array Element From JSON Using T-SQL

I have a following response string from Google Geocoding API stored in a SQL Server database: { "results":[ { "address_components":[ { "long_name":"Khalifa City", "short_name":"Khalifa…
knyazs
  • 99
  • 7