0

We are using MySQL 8.0. We have a JSON column(options) that stores an array of objects. I want to use this field in my Select query but I don't need the point field. I tried JSON_EXTRACT, and JSON_OBJECT but could not come up with an answer. Can some one please guide me.

"options": [
                {
                    "links": [
                        "https://abc1.com"
                    ],
                    "point": 10,
                    "option": "0-100"
                },
                {
                    "links": [
                        "https://abc1.com"
                    ],
                    "point": 20,
                    "option": "101-200"
                },
                {
                    "links": [
                        "https://abc2.com"
                    ],
                    "point": 50,
                    "option": "201-500"
                },
                {
                    "links": [
                        "https://abc3.com"
                    ],
                    "point": 75,
                    "option": "501-1000"
                },
                {
                    "links": [
                        "https://abc4.com"
                    ],
                    "point": 100,
                    "option": ">1000"
                }
            ],

Actual Output:

[
                {
                    "links": [
                        "https://abc1.com"
                    ],
                    "option": "0-100"
                },
                {
                    "links": [
                        "https://abc1.com"
                    ],
                    "option": "101-200"
                },
                {
                    "links": [
                        "https://abc2.com"
                    ],
                    "option": "201-500"
                },
                {
                    "links": [
                        "https://abc3.com"
                    ],
                    "option": "501-1000"
                },
                {
                    "links": [
                        "https://abc4.com"
                    ],
                    "option": ">1000"
                }
            ]
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.