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

Arithmetic operation in json_query (syntax wrong) - Ansible

I have the following dictionary: dict1: {x: 1, y: 2} I want to add third value z that should be (x/y)*100, or in other words percentage. This is the code I wrote, but something is wrong with the syntax for this arithmetic operation. - hosts:…
LJS
  • 317
  • 1
  • 9
0
votes
2 answers

Does JSON_QUERY have a data limit in oracle 12c

I need an array to be extracted from a json column in oracle 12c. JSON_QUERY is working for some rows while it isnt returning anything for a few rows. I'm trying to extract the array which is in the 56th row and the array contains about 11000…
AnuC
  • 131
  • 1
  • 11
0
votes
3 answers

SQL Server - How to create custom JSON from SELECT with "key": derived from GROUP BY clause

I am trying to get nice overview of dependencies of tables. My query looks like this: (if there is something better than STRING_AGG, please let me know) SELECT [schema] = referencing_schema_name, [objects] = JSON_QUERY('["' +…
Dalton
  • 347
  • 3
  • 15
0
votes
1 answer

SQL Server 2019 - Build JSON with spread operator

I'm required to supply a json object like this: [ { id: '59E59BC82852A1A5881C082D5FFCAC10', user: { ...users[1], last_message: "16-06-2022", topic: "Shipment" }, unread: 2, …
Joe
  • 1,033
  • 1
  • 16
  • 39
0
votes
2 answers

Remove the square and curly brackets from the column of joined table in Microsoft SQL server

I'm using Microsoft SQL server v14.0.1000 I'm using the below query to convert my query result into JSON : SELECT TOP(5) dn.id AS ID, dn.EventTimeStamp AS EventTimeStamp, dn.ControllerId AS ControllerID, JSON_QUERY((SELECT…
saurabh
  • 31
  • 6
0
votes
0 answers

can't load json-query package

In Windows cmd, I typed npm install json-query It seemed successfully by typing: npm -v json-query It said version of 8.5.5. In my HTML, I did
Justin
  • 327
  • 3
  • 13
0
votes
1 answer

Error getting an item from json file in Ansible

I am trying to get the subnets from a json query in Ansible. My debug is result is as below: "msg": [ { "address_prefix": "10.10.2.0/23", "id":…
MoonHorse
  • 1,966
  • 2
  • 24
  • 46
0
votes
1 answer

How to extract array data from a JSON Column in SQL Server (OPENJSON, JSON_QUERY)

We have a SQL Server table that has a varchar(max) column with JSON data, but one of the fields is an array. Try as I might I can't get it to extract these one-per-row. In the past I've managed to do it where each array was made up of named members,…
Bobby Tables
  • 111
  • 3
  • 12
0
votes
2 answers

R - Query JSON and Save to Variable

So I'm trying to clean some data in R, Im not very experinced with R. What I would like to do is Get a certain peice of Data from a JSON and store it into a Varaible The JSON is very large and messy, I tried using JSON Lite and using the $ Variable…
0
votes
1 answer

Ansible tagging AWS EBS volumes using ec2_instance_info module to pull info

I'm running ansible 2.9 I am trying pull ec2 info with the "ec2_instance_info" module. Ultimately, I need to tag instance-attached EBS volumes with the instance_id, and EBS device_name. These are the tasks that I have working: - name: Gather…
0
votes
1 answer

ansible json_query to with dicts containing key values as list

I have a below value in a variable allcsv "msg": [ { "added_bundle_images": [ "locuz.qe.pnq.local/eng-build/lzfirewallmod:v4.8.3-10" ], "index_image": "locuz.qe.pnq.local/eng-build/iib:297699", …
Niranjan M.R
  • 343
  • 1
  • 6
  • 23
0
votes
2 answers

Insert a loop variable into json_query in a when condition (ansible)

I have a json query that returns this result when run using set_fact and displaying using debug: ''' Json_query: hits | community.general.json_query('results[?item==`xyz`].count') debug output: TASK [debug]…
Aksha
  • 11
  • 2
0
votes
1 answer

I'm trying to get ansible output formatted like item1 - item2 instead of two separate lists of items

I have a functioning ansible script that connects to AWS and prints out tags from instances in a specified state. The problem I'm having is the print out is two separate lists e.g. What I get…
0
votes
2 answers

JSON Query Not returning Value in Ansible playbook

Using Ansible, I have a large JSON file that I need to extra a few values from. A simplified version is here, but shows the basic structure: { "metadata": { "version": "1.2.3.4" }, "operations": [ { "resourceType": "type1", …
JScott
  • 73
  • 2
  • 9
0
votes
1 answer

Oracle 12.1 JSON_TABLE query fails during fetching rows

Oracle database 12.1 I have a table with a 2Gb json clob column (column name is jsonfile). The JSON clob loaded from file contains 2.530.000 records (viewed with Dadroit json viewer). I want to load all the columns into a new table using json_table…