Zend certified PHP/Magento developer

How to create GraphQl custom Scalar type in Magento 2

I wanted to create a new Scalar type as my output is having both string and array.

I want my response in the below format.

"custom_attributes": [
            {
                "attribute_code": "color",
                "value": "red"
            },
            {
                "attribute_code": "size",
                "value": "M"
            },
            {
                "attribute_code": "category_ids",
                "value": [
                    "3",
                    "333"
                ]
            }
  ]