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
1
vote
1 answer

Concatenate Array Values Using Json_Query

I have a table in a SQL Server database that stores JSON in one of its columns. The structure is as follows: Table Person | Name | ExtraInfo | |--------|:------------------------------------------:| | Bob | …
Dalsier
  • 377
  • 3
  • 14
1
vote
1 answer

TSQL How do i check array is a subset using JSON_QUERY

I have the following Table Documents where data is stored in JSON format. DocumentID Status Data ------------------------------------------ 1 Active '{ "AccountNumber":["A1","A2","A3","A4"] }' 2 Active …
LP13
  • 30,567
  • 53
  • 217
  • 400
1
vote
1 answer

Ansible iterate over complex dictionary

I have the following XML file and trying to replace the values for each attribute based on created dictionary, but having troubles to iterate over the complex dict. config.xml file
Marek
  • 127
  • 1
  • 8
1
vote
1 answer

Is there a way in Ansible to replace a dictionary value based on k:v lookup to another dictionary?

I have k:v dictionary of hostname: IP that I want to use in a lookup from another dictionary to replace entries matching key from 1st dictionary and replacing it with the corresponding value in 2nd dictionary; 1st: "nb_console_ip": { …
Niall
  • 37
  • 7
1
vote
1 answer

jmespath. Change one element in an array depending on type

Im use Ansible filter json_query data: [ "just_dir", { "path": "extend_dir", "order": "nginx" } ] I want to get: [ { "path": "just_dir", }, { "path": "extend_dir", "order": "nginx" } ] merage([?type(@) ==…
1
vote
1 answer

json_query - Get object key of current node

I am trying to access an object key of the current node pkgs: pkg1: package_description: xzy owner: node1 pkg2: package_description: desc2 owner: node2 What I need is an object that looks like this - name: pkgs1 …
Chris
  • 3,581
  • 8
  • 30
  • 51
1
vote
3 answers

Ansible playbook json_query

After having loaded the following Ansible local facts : { "cdbs": { "e01ca601": { "char_set": "AL32UTF8", "home": "/u01/dbhome_1", "npdbs": "1", "pdbs": "pdb1" }, …
dirk
  • 21
  • 2
1
vote
1 answer

Ansible json_query different result in python3 vs python2

i bumped into an issue after migrated from python2 to python3. Seems that migration somehow changed the way how json query is being processed. Maybe anyone has a hint how to fix this vars: vmk_out: host_vmk_info: hostname: [ …
Marek
  • 127
  • 1
  • 8
1
vote
1 answer

How to extract items with Ansible from stdout using json_query

I am executing shell script with Ansible which returns json output. - name: Get mlist become: no shell: "PYTHONPATH=/home/centos/scripts/users/ python /home/centos/scripts/users/team_members.py {{ parameter }}" register:…
aRagornol
  • 235
  • 3
  • 17
1
vote
1 answer

ANSIBLE - Json_Query - Filter result

Inside my ansible playbook, I' m trying to filter a json result but for now, it doesn't work. 1/ Playbook Below My ansible playbook to query and filter the result: tasks: - name: "Query Attributes" ... ... register:…
juju
  • 13
  • 1
  • 1
  • 4
1
vote
1 answer

How to write a SQL query in CosmosDB for a JSON document which has nested/multiple array

I need to write a SQL query in the CosmosDB query editor, that will fetch results from JSON documents stored in Collection, as per my requirement shown below The example JSON { "id": "abcdabcd-1234-1234-1234-abcdabcdabcd", "source": "Example", …
1
vote
1 answer

Having trouble querying JSON with Json.Net after converting from XML

I have some XML which I convert to JSON by invoking this method: public static string SerializeAsJson(string xml) { if (string.IsNullOrEmpty(xml)) throw new ArgumentNullException(nameof(xml)); if (xml.StartsWith("{") && xml.EndsWith("}"))…
r3plica
  • 13,017
  • 23
  • 128
  • 290
1
vote
1 answer

Ansible nested json value extraction using json_query

I am looking for some to extract the value from a nested json when the condition is matching Here you can see three different items are listed. I wanted to exact item value when the "target-name": "$variable" For example if "target-name":…
mikeraj2019
  • 39
  • 2
  • 10
1
vote
1 answer

JSON format issues with JSON_QUERY and C#

I have a JSON blob column (eg Groups) in a user table that contains a json object as follows: {Security:[1,5],Reporting:[2,8]} If i try and query that table using JSON_QUERY I get a badly formatted error. So for eg SELECT…
Gotts
  • 2,274
  • 3
  • 23
  • 32
1
vote
1 answer

How to escape colon character in json query using ansible

Running ec2_instance_facts Ansible module and registering it to a variable called ec2. I have tags on ec2 instance which has colon characters in its key name. I can grab environment tag value using this: set_fact: number_of_nodes: "{{…
sherri
  • 421
  • 2
  • 9
  • 19