I use this query:
JSON_ARRAYAGG(JSON_OBJECT("id",pd.id_pedido_detalle,"cantidad",pd.cantidad,"precio",pd.precio_pedido))
This gives me the following result:
[{id: 991, cantidad: 1, precio: 10}, {id: 992, cantidad: 1, precio: 20}]
I try to convert it, with javascript , to a json and it throws me the following error:
On this link I use JSON Editor Online , to see the why, and it's because the "" in the keys are missing.
In this link add the quotes to the keys to show that it's just that what's missing.