I struggle to extract the required values from the JSON column in MySQL. Imagine the variable:
SET @j = '[{"a": 1, "b": 2},{"a": 3, "b": 4, "c": {"d": 4}}, {"a": 5}]';
and I need to extract and return a new JSON array containing only selected key-value pairs, eg.: only a's and b's and if the required key does not exist I want to return null for that key:
[{"a": 1, "b": 2},{"a": 3, "b": 4},{"a": 5, "b": null}]
thanks