'How to write a dictionary value when calling a function in Power Query/M Language?

I have a function that queries data from an external api (making a power connector). I need one of my inputs for the api to be json text (could be nested json). However from the Power BI UI side, I can only pass in things like numbers, text, lists... I could write it as a JSON encoded string like this

MyLibrary.GetData("{""key"":{""key2"":""value""}}")

But this looks messy. I would like to write it natively like this for example (then convert it to json text in M language).

MyLibrary.GetData({"key":{"key2":"value"}})

How can I do this?



Solution 1:[1]

Figured it out. There is a record type like this [key=Value]. Value can be any type.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 omega