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.
Questions tagged [json-query]
169 questions
17
votes
2 answers
How to search SQL column containing JSON array
I have a SQL column that has a single JSON array:
{"names":["Joe","Fred","Sue"]}
Given a search string, how can I use SQL to search for a match in the names array? I am using SQL 2016 and have looked at JSON_QUERY, but don't know how to search for…
![](../../users/profiles/2737646.webp)
paultechguy
- 1,650
- 1
- 18
- 31
12
votes
2 answers
MySQL nested JSON column search and extract sub JSON
I have a MySQL table authors with columns id, name and published_books. In this, published_books is a JSON column. With sample data,
id | name | published_books
-----------------------------------------------------------------------
1 | Tina | …
![](../../users/profiles/1983908.webp)
Kanmaniselvan
- 474
- 1
- 8
- 21
6
votes
2 answers
JS Object Query Syntax
I'm trying to find a way filter js collection with a query syntax similar to SQL.
The only library I found to accomplish this task is json-query.
It works in some cases but it has limitations. It isn't possible to query on different object levels…
![](../../users/profiles/488413.webp)
Pietro
- 1,527
- 24
- 55
6
votes
3 answers
Where clause on json data in Sql Server 2016
I have a nvarchar(1000) field in my table and I am storing JSON data in that column.
eg :
CONTENT_RULE_ID CONTENT_RULE
1 {"EntityType":"Inquiry", "Values":[1,2]}
2 {"EntityType":"Inquiry", "Values":[1,3]}
3 …
![](../../users/profiles/9113465.webp)
Harisyam M
- 387
- 2
- 13
6
votes
3 answers
SQL Server 2016 select where in json array
I have a table [JsonTable], and the column [JsonData] save the json string,
JsonData like:
{
"Names": ["John", "Joe", "Sam"]
}
How can I inner join this table like:
SELECT* FROM [TestTable] AS T
INNER JOIN [JsonTable] AS J ON T.[Name] IN…
![](../../users/profiles/7324189.webp)
Max
- 2,987
- 2
- 12
- 28
5
votes
1 answer
C# Dapper using JSON_VALUE for SQL Server 2016
I want to query data from my table using JSON_VALUE:
var str = "123";
var value = "Name"
using(var conn = GetMyConnection())
{
var result = conn.QueryFirstOrDefault(
@"SELECT [Id] FROM [dbo].[MyTable]
WHERE…
![](../../users/profiles/7324189.webp)
Max
- 2,987
- 2
- 12
- 28
5
votes
1 answer
ansible json-query path to select item by content
Does anyone know what json-query filter can be used to select Tigger's food in the sample JSON below? The JSON is a simplified stand-in for a massive and relatively complicated AWS blob.
Some background: I was rather pleased to discover that…
![](../../users/profiles/2480661.webp)
Max Murphy
- 955
- 1
- 7
- 22
4
votes
1 answer
Delete an object from nested array in openjson SQL Server 2016
I want to delete the "AttributeName" : "Manufacturer" from the below json in SQL Server 2016:
declare @json nvarchar(max) = '[{"Type":"G","GroupBy":[],
"Attributes":[{"AttributeName":"Class Designation / Compressive…
![](../../users/profiles/3087678.webp)
Jebin
- 123
- 1
- 9
3
votes
2 answers
mongoexport - issue with JSON query (extended JSON - Invalid JSON input)
I have started learning MongoDB recently. Today the instructor taught us the mongoexport command. While practicing the same, I face a typical issue which none of the other batchmates including the instructor faced. I use MongoDB version 4.2.0 on my…
![](../../users/profiles/1001242.webp)
itsraghz
- 615
- 9
- 21
3
votes
2 answers
How I can use Variables in Ansible json_query?
I want to use a ansible variable inside the json query filter.
This is my Code:
Playbook execution:
ansible-playbook debug.yml -e "project_environment=live"
- debug:
msg: "{{ project_environment }}"
- debug:
msg: "{{ check_objects |…
![](../../users/profiles/11815770.webp)
bswe
- 50
- 1
- 6
3
votes
1 answer
SQL Server - "for json path" statement does not return more than 2984 lines of JSON string
I'm trying to generate huge amount of data in a complex and nested JSON string using "for json path" statement, and I'm using multiple functions to create different parts of this JSON string, as follow:
declare @queue nvarchar(max)
select @queue =…
![](../../users/profiles/5536921.webp)
Brian SP
- 306
- 1
- 8
- 18
2
votes
2 answers
Match a key to value from a dict and replace a value matching another dictionary using ansible
I've a dictionary containing the below items.
PID:
Cisco:
- A9K-MOD80-TR
- A9K-RSP440-TR
- ASR9001-LC
- SFP-10G-SR
The above dictionary I want to match with the list below with the following logic, if "SFP-10G-SR" (or any of the…
![](../../users/profiles/14960264.webp)
toen89
- 35
- 3
2
votes
1 answer
Ansible - remove user from group x if already in other group
I am looking for the easiest way to remove users from group x when they are already in group google-sudo. I store users in group vars in this kind of list and dictionary combination:
user_account:
- name: jenny
authorized_keys:
-…
![](../../users/profiles/7686045.webp)
Brzozova
- 329
- 1
- 12
2
votes
1 answer
GET last element of array in json column of my Transact SQL table
Thanks for helping.
I have my table CONVERSATIONS structured in columns like this :
[ ID , JSON_CONTENT ]
In the column ID i have a simple id in Varchar
In the column JSON_CONTENT i something like this :
{
"id_conversation" :…
![](../../users/profiles/7613485.webp)
Loïs Faidherbe
- 23
- 4
2
votes
2 answers
Combine attribute value using json_query in ansible
I want to combine two attribute into single string separated by delimiter using the json_query in ansible
Sample data
{
"locations": [
{"name": "Seattle", "state": "WA"},
{"name": "New York", "state": "NY"},
{"name": "Bellevue",…
![](../../users/profiles/6234847.webp)
Snkini
- 391
- 1
- 3
- 14