Clemens Valiente
02/14/2024, 8:04 AMadd_card_v3_rsm so my json path is """$.model_results[?(@.name=="add_card_v3_rsm")].score"""
when I do
SELECT JSON_Query('$json', '$jsonPath') as json_extract
I get [ 0.06742525] as a result. but since the score is a scalar and I want to use it as such, I would like to use JSON_VALUE . but when I run the same jsonpath in JSON_VALUE i get null as result? I thought this is the point of this functionTim Wolfe
02/24/2024, 7:54 PMJSON_VALUE is used to extract a single, simple value and doesn't support complex queries with conditions. Since your JSON path includes a filter ([?(@.name=="add_card_v3_rsm")]), JSON_VALUE returns null because it can't process the filter. JSON_QUERY can handle complex structures like arrays or objects, which is why it works but gives you an array. To get a scalar value with a condition, you might need a more advanced query technique specific to your SQL system, like using CROSS APPLY in SQL Server or equivalent functions in other databases.Clemens Valiente
02/26/2024, 4:43 AM