I have a requirement that I need to write a mysql function which takes 'JSONText', 'color' as parameters and output based on the 'color'
[ 
  {
    "color":"red",
    "points":4
  },
  {
    "color": "Electric Blue",
    "points": 5
  }
 ]
So, my function would be
 DELIMITER $$
 CREATE FUNCTION GetColorPoints(JSONParam Text, color VARCHAR(10)) RETURNS INT
 BEGIN
        **???** //WHAT SHOULD GO HERE??
 END$$
 DELIMITER;
So, if I call the function with inputs, it should give me points.
 SELECT GetColorPoints('[ {"color":"red", "points":4}, {"color": "Electric Blue", "points": 5} ]', 'Electric Blue') AS 'ColorPoints';
 
    