Questions tagged [json-arrayagg]
55 questions
7
votes
1 answer
How to return DISTINCT values in a JSON_ARRAYAGG when using JSON_OBJECT
How to use DISTINCT with JSON_ARRAYAGG?
Let's consider the below query as an example.
SELECT
staff.company,
JSON_ARRAYAGG(
JSON_OBJECT(
'uuid', UuidFromBin(staff.uuid),
'username', staff.username,
…

Radhe Shyam sharma
- 900
- 15
- 21
3
votes
1 answer
MySQL query JSON result is cut off
When doing:
mysql -u case -p < MyQuery.sql
with the query being:
SELECT JSON_ARRAYAGG(JSON_OBJECT('field1', field1, ...)) FROM db.table
the printed output is cut off at a random point, halfway a JSON tag. But it does end with ].
Apparently my…

meaning-matters
- 21,929
- 10
- 82
- 142
2
votes
1 answer
Dynamic Column List in JSON Query in Oracle
I'm looking for a way to create/pass a dynamic column list for use in generating a JSON document.
Creating the following (on Oracle 19c):
CREATE TABLE tbl1 (val1 varchar2(10), val2 varchar2(10), val3 varchar2(10));
INSERT INTO tbl1 VALUES…

DBox
- 49
- 1
- 7
2
votes
1 answer
MySQL convert Grouped JSON selection into a single JSON Object
I have a table
---------+-----------
| type_id | A | B | A |
---------+-----------
| stock | 1 | 2 | 2 |
---------+-----------
I'm trying to run
select stock.type_id, sum(stock.stock)
from stock group by type_id;
Turning it into JSON object
I…

Yuriy Semenikhin
- 90
- 5
2
votes
2 answers
JSON decoding removing decimal trailing zeros
I have a JsonArray and need to convert it into Array of objects. Below is the code I am using.
response - json response
ArrayList list = new ArrayList<>();
JsonArray jsonArray = new JsonArray(response);
…

supriya
- 37
- 1
- 5
1
vote
1 answer
Skipping JSON_ARRAYAGG array when one of the value is not available-In Oracle
I am working in JSON_ARRAYAGG in Oracle .I have a scenario that Json array have 2 attributes.
One attribute is hardcode value another one fetches value from outer query .
I want to skip whole Json_array to be skipped when the second attribute…

Arun
- 15
- 4
1
vote
1 answer
Conditional check for Json array in Karate framework
Want to validate in Karate framework
For the below Json What I want to validate is,
if "isfilter_regex":0 then "msgtype": "##regex ^[A-Za-z0-9_.]-/*"
or if "isfilter_regex":1 then "msgtype": "#string"
(when isfilter_regex = 1 then msgtype must be a…

user14719581
- 31
- 4
1
vote
1 answer
JSON_ARRAYAGG return value with "\"
I am using json_arrayagg in Oracle to create a json array from multiple rows in a table. Here are details:
create table classInfo (classId integer, category CLOB);
insert into classInfo(1, '{"category":"AAA"}');
insert into classInfo(2,…

mike zenon
- 31
- 4
1
vote
0 answers
how to convert json to row and column format using oracle
{ "Message ": [ { "PACK_NO": "219069571", "COMPONENT_ITEM": [ { "ITEM": "308187417", "PACK_QTY": 2 } ] }, { "PACK_NO": "219069572", "COMPONENT_ITEM": [ { "ITEM": "308187419", "PACK_QTY": 2 } ] }, { "PACK_NO": "219178060", "COMPONENT_ITEM": [ {…

Ravi_Deshmukh
- 21
- 3
1
vote
1 answer
Oracle Cloud DB 19c bug with JSON_ARRAYAGG
I try to use JSON_ARRAYAGG into select and get bug result with the same data
SELECT json_object(
'buy' VALUE JSON_ARRAYAGG(b.buysum),
'total' VALUE JSON_ARRAYAGG(b.totalsum)
)
FROM (
select *
from view_count_sum
…

koa73
- 861
- 2
- 10
- 27
1
vote
0 answers
Json response comparision in java ignoring ordering in json array
I want to compare two json responses.I need a way to compare the reponses by not only ignoring the order of child attributes but also the ordering of elements inside json array.
For ex:
target response:
{
name:abc,
category:bbb
…

SasukeUchiha
- 31
- 1
- 3
1
vote
1 answer
Getting JSONArray from mysql database Using Spring boot JPA
In my mysql table has column that store 'JSONArray'
This is a part of model class in spring-boot project.
public class SubQuestions implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name =…

Kaumadie Kariyawasam
- 1,232
- 3
- 17
- 35
1
vote
1 answer
How to apply Indent to array json in java
We are reading the file changing the content and writing back to the same location.
How to apply indentation to a JSON array in java/only specific properties?
Source code:
import com.google.gson.JsonElement;
import…

Purushothama
- 89
- 1
- 8
1
vote
0 answers
MariaDB query JSON result escapes a double quote in text column as \\"
I'm converting an SQL query to JSON using something like:
SELECT JSON_ARRAYAGG(JSON_OBJECT('field1', field1, ...)) FROM db.table
One of my columns of string type contain simple ASCII strings with double quotes (") here and there.
My problem is that…

meaning-matters
- 21,929
- 10
- 82
- 142
0
votes
1 answer
Append to JSON_ARRAY in an existing JSON in ORACLE
I'm trying to combine arrays of JSON documents in Oracle 19c.
I'd like to append items to an array in an already existing JSON stored in a table. I know this question has been asked in various forms before (with helper functions and SQL…

DBox
- 49
- 1
- 7