SELECT JSON_QUERY(j,'$.keyvalue()' WITH ARRAY WRAPPER)
FROM (VALUES ('{"k":"v", "k2": 42}')) t(j)
This example returns the following JSON array where each entry represents a key/value pair from an object. The “id” property can be used to match those key/value pairs that originate from the same JSON input object together.
You can’t catch up on 20 years of SQL evolution in one day. Subscribe the newsletter via E-Mail, Bluesky or RSS to gradually catch up and to keep modern-sql.com on your radar.
About the Author
Markus Winand provides insights into SQL and shows how different systems support it at modern-sql.com. Previously he made use-the-index-luke.com, which is still actively maintained. Markus can be hired as trainer, speaker and consultant via winand.at.